您的位置:首页 > 其它

salesforce看pdf文档总结的一些小知识点

2013-07-15 18:01 267 查看
1、debug调用测试类里面的方法:

HelloWorld.sayYou();-- sayYou是类HelloWorld的静态方法

MyController c = new MyController();

c._methodName();--调用

2、基本数据类型及其方法调用

salesforce_apex_language_reference.pdf ( P228)

3、apex_workbook.pdf

collections

1)怎样去创建一个list且打印 出它的大小

List<Integer> myList = new List<Integer>();

System.debug(myList.size());

2)

数组在apex中是和list是同义的---apex提供了类似于使用list的语法,要创建一个list可以用另一个方法

Arrays in Apex are synonymous with lists—Apex provides an array-like syntax for accessing lists. Here is an alternative way

to create exactly the same list:

Integer[] myList = new List<Integer>();

3)创建list并初始化

List<String> myStrings = new List<String> { 'one', 'two' };

4、loop

for

1)

for (Integer i = 1; i <= 10; i++){

System.debug(i);

}

2)

Integer[] myInts = new Integer[]{10,20,30,40,50,60,70,80,90,100};

for (Integer i: myInts) {

System.debug(i);

}

5、how to debug

setup->logs-->debug log

选择要DEBUG的User对象

然后你在你的apex里面,写System.debug(variable),就可以在上面的页面中看到该apex class 中打印 |DEBUG|.....,就可以进行测试了

6、关于calendar里面关于Month 类的相关方法总结

详细参照论坛网址: http://boards.developerforce.com/t5/General-Development/Help-regarding-Test-case/m-p/315365/highlight/true#M58418

1)初始化month 对象

获得当前月

Month month = new Month(Date 类型); Date --可以是本月的第一天,或是特定的某一天

Date d = month.getFirstDate(); // 获得本月的第一天

获取当前系统时间日期

Date d = system.today();

获取当前系统时间月份

Month m = d.month();

获取当前系统时间某天

Day day = d.day();

6、json 序列化对象
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_json.htm
点击这里 json

js 解析json

/article/7053455.html

js 解析json

7、jquery .tmpl

tmpl用法

8、chatter
http://wiki.developerforce.com/page/Chatter_Code_Recipes http://wiki.developerforce.com/page/An_Introduction_to_Salesforce_Chatter
9、导入静态资源

注意:

1)必须是zip包

2)如果你包里面有一个父文件夹,必须在路径上体现

如你解压后文件夹名是jqui

静态资源引用是也要写上,不能只写jqui里面文件夹

<apex:includeScript value="{!URLFOR($Resource.jquidate, 'jqui/ui/jquery.ui.core.js')}"/>

10、date类型转换

1) string 转换为date类型

貌似必须是yyyy-MM-dd的形式,只能用‘-’连接符,不能用‘/’否则用Date da = date.parse(string strdate);就会报错

所以只能写成这样:date.parse(‘2013-08-05’);

不知道是什么原因,暂时写这样写吧

2) datetime类型转换成String 类型:

DateTime dt ;

String str_dateTime = dt.format('yyyy-MM-dd hh:mm:ss');

11、全局变量

vf-guide P487

{!$UserRole.Name} --- 用户角色

{!$Profile.Name} ---- 判断是否是系统管理员(简档)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: