salesforce中常用技能总结(纯粹干货,深度积累)图解

转载原文链接:http://blog.csdn.net/itsme_web/article/details/53976204

1、使用SOQL语句查询时,字符串类型的只能使用‘单引号’,否则报错:Unknown error parsing query;

eg:SELECT Id, Subject, CaseNumber, Status, Priority 

        FROM Case 

        WHERE CaseNumber = '00001036' //注意此处autoNumber类型数字为String类型

使用SOQL其他注意事项:

      a、尽量使用Order By,保证查询结果的稳定性;
      b、使用LIMIT,防止数据量超过50000而报错;
  c、使用Offset偏移时,一定放在该查询语句的最后面,其限制及应用场景见:https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_offset.htm?search_text=offset

2、标准字段的API Name即为该标准字段的Field Name;

eg:Case标准对象的Subject API Name即为 Subject

3、计算两个日期之间相隔的天数:

eg:TODAY() - DATEVALUE( CreatedDate )

        Implementd__Date__c - DATEVALUE( CreatedDate )

注意:只有当日期为标准字段时,才使用DATEVALUE()来转化

4、在terminal中使用curl方式查看json数据(通常使用workbench>utilities>REST Explorer),通常会用到sessionId,获取方法如下:

String sessionID = UserInfo.getSessionId();
System.debug(sessionID);

5、完整版REST services demo

[java]  view plain  copy
  1. @RestResource(urlMapping='/Cases/*')  
  2. global with sharing class CaseManager {  
  3.     @HttpGet  
  4.     global static Case getCaseById() {  
  5.         RestRequest req = RestContext.request;  
  6.         String caseId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);  
  7.         Case result = [SELECT CaseNumber, Subject, Status, Origin, Priority  
  8.                        FROM Case  
  9.                        WHERE Id = :caseId];  
  10.         return result;  
  11.     }  
  12.     /*  
  13. HttpGet步骤:  
  14. 1、创建RestRequest类型的req对象(RestContext.request的返回值类型就是RestRequest)  
  15. 2、通过req对象的requestURI属性利用字符串检索技术拿到caseId  
  16. 3、创建Case对象result,并将通过caseId查到的记录赋值给该对象,注意“WHERE Id = :caseId”  
  17. 4、返回Case对象  
  18. */  
  19.     @HttpPost  
  20.     global static ID createCase(String subject, String status,  
  21.         String origin, String priority) {  
  22.         Case thisCase = new Case(  
  23.             Subject=subject,  
  24.             Status=status,  
  25.             Origin=origin,  
  26.             Priority=priority);  
  27.         insert thisCase;  
  28.         return thisCase.Id;  
  29.     }  
  30.     /* 
  31. HttpPost步骤: 
  32. 1、声明并创建一个Case类型对象thisCase,并为该对象的标准字段赋值 
  33. 2、将自定义对象插入到Case表中形成一条记录 
  34. 3、返回一个新纪录的类型为ID的变量Id用于查找新纪录 
  35. */  
  36.     @HttpDelete  
  37.     global static void deleteCase() {  
  38.         RestRequest req = RestContext.request;  
  39.         String caseId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);  
  40.         Case thisCase = [SELECT Id FROM Case WHERE Id = :caseId];  
  41.         delete thisCase;  
  42.     }  
  43.     /* 
  44. 思路: 
  45. 要删除某一条记录首先要找到该记录,而方法可以是利用soql语言查找到某一记录的主码,这里是Id(使用rest服务请求获取到uri后从uri中取得的id) 
  46. HttpDelete步骤: 
  47. 1、创建ResrRequest对象req 
  48. 2、声明caseId,并将rest请求到的uri截取/后的值赋给该变量 
  49. 3、利用soql语句查到Id = :caseId的那条记录 
  50. 4、删除该记录 
  51. */  
  52.     @HttpPut  
  53.     global static ID upsertCase(String id, String subject, String status, String origin, String priority) {  
  54.         Case thisCase = new Case(  
  55.         Id = id,  
  56.             Subject = subject,  
  57.             Status = status,  
  58.             Origin = origin,  
  59.             Priority = priority  
  60.         );  
  61.         upsert thisCase;  
  62.         return thisCase.Id;  
  63.     }  
  64.     /* 
  65. HttpPut步骤: 
  66. 1、声明并创建一个Case类型对象thisCase,并为该对象定义标准字段赋值 
  67. 2、将自定义对象插入到Case表中形成一条记录或者更新Id为id的记录 
  68. 3、返回一个新纪录的类型为ID的变量Id用于查找新纪录 
  69. */  
  70.     @HttpPatch  
  71.     global static ID updateCaseFields() {  
  72.         RestRequest req = RestContext.request;  
  73.         String caseId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);  
  74.         Case thisCase = [SELECT Id FROM Case WHERE Id = :caseId];  
  75.         Map<String, Object> params = (Map<String, Object>)JSON.deserializeUntyped(req.requestBody.toString());  
  76.         for(String fieldName : params.keySet()) {  
  77.             thisCase.put(fieldName, params.get(fieldName));  
  78.         }  
  79.         update thisCase;  
  80.         return thisCase.Id;  
  81.     }  
  82.     /* 
  83. HttpPatch步骤: 
  84. 1、创建RestRequest类型的req对象(RestContext.request的返回值类型就是RestRequest) 
  85. 2、通过req对象的requestURI属性利用字符串检索技术拿到caseId 
  86. 3、创建Case对象,并把按Id查到的Case表记录赋值给该对象 
  87. 4、将请求获得的requestBody转化成字符串后,反序列化为对象强制转化为Map<String, Object>后赋值给Map变量params 
  88. 5、遍历对象的key,并在通过id找到的Case对象thisCase中写入key-value 
  89. 6、更新记录 
  90. 7、返回记录的id 
  91. */  
  92. }  
  93. /* 
  94. 共性: 
  95. 1、每个对象系统自带一个Id属性,它是系统自动分配的; 
  96. 2、每一种Http方法均为global static 
  97. 3、@HttpPut与@HttpPost的区别(upsert,insert) 
  98. */  


区别:put vs patch

the same:You can update records with the put or patch methods.

the difference: put can either create new resouce or update the existing resource; patch can update the existing resouce exclusively.

6、Apex中在使用类继承时需要使用到的关键字:extends,super,virtual,override.跟Java继承不同的是,超类必须使用virtual修饰,子类使用override和extends修饰,如果需要重写父类的方法,父类中该方法需要用virtual修饰,子类需要使用override。另外如果子类需要使用超类的域或者方法则需要使用super关键字,注意构造方法的复用不需要用成对的virtual和override关键字修饰超类的构造方法和子类的构造方法。

7、利用公式字段插入图片:IMAGE(path,img_title,height,width)

8、在report中使用The "Power of One" technique来统计不重复的数据

9、在Apex中使用静态资源加载jquery:

[plain]  view plain  copy
  1. <apex:page>  
  2.       
  3.     <!-- Add the static resource to page's <head> -->  
  4.     <apex:includeScript value="{! $Resource.jQuery }"/>  
  5.       
  6.     <!-- A short bit of jQuery to test it's there -->  
  7.     <script type="text/javascript">  
  8.         jQuery.noConflict();  
  9.         jQuery(document).ready(function() {  
  10.             jQuery("#message").html("Hello from jQuery!");  
  11.         });  
  12.     </script>  
  13.       
  14.     <!-- Where the jQuery message will appear -->  
  15.     <h1 id="message"></h1>  
  16.       
  17. </apex:page>  

10、简单的使用vf标准控制器来展示Contact列表,并实现点击名称跳转详细页面。方法有三种:

[plain]  view plain  copy
  1. <apex:page standardController="Contact" recordSetVar="contacts">  
  2.     <apex:pageBlock title="Contact List">  
  3.         <apex:repeat value="{!contacts}" var="ct">  
  4.             <li>  
  5.                 <apex:outputLink value="/{!ct.Id}">{!ct.Name}</apex:outputLink>  
  6.                 <!-- <apex:outputLink value="{!URLFOR($Action.Contact.View,ct.id,[retURL=''])}">{!ct.Name}</apex:outputLink> -->  
  7.                 <!-- <apex:outputLink value="https://componentstest-dev-ed.my.salesforce.com/{!ct.Id}">{!ct.Name}</apex:outputLink>  -->  
  8.             </li>  
  9.         </apex:repeat>   
  10.     </apex:pageBlock>  
  11. </apex:page>   

11、增强lookup查找功能:我们通过lookup进行对父记录Name进行搜索时,通常默认只能使用Name来搜索,有时候比如我们在子记录中想要通过Phone来搜索Account的Name,这个时候可以在setup->enter 'Search Settings' in Quick Search Box中即可增强搜索

12、将使用html编辑的前端网站放到force.com平台上的方法:将做好的网站,比如shangpinhui/Bootstrap所有文件打包成zip上传到salesforce的Static Resources中,比如拿shangpinhui为例,目录结构为:shangpinhui->images/js/css/index.html,打包上传后命名为ShangpinhuiZip(名字不能一数字开头),之后在Visualforce Pages中编辑如下代码:

[plain]  view plain  copy
  1. <apex:page docType="html-5.0" sidebar="false" showHeader="false" standardStylesheets="false"   
  2.       action="{!URLFOR($Resource.ShangpinhuiZip, 'shangpinhui/index.html')}">  
  3. </apex:page>  

在action里面通过URLFOR表达式来将页面加载进去。这样就不用考虑修改网站页面资源引用的路径了,注意在Developer Edition里面由于每个账号限制只允许放一个网站绑定一个url,所以要实现多个网站同时上传作为作品展示,可以再做一个列表,分别通过超链接映射到相应的网站上,这样就可以将您的所有作品都绑定在一个页面上分别访问。

13、在Company Information中可以查看User Licence的使用次数,如下图:

14、recordSetVar与<apex:variable value="{!}" var=""/>的适用场景比较:
recordSetVar保存的是SOBject的List,一般会与<apex:pageBlockTable>以及<apex:page>的熟悉standController(即可以传标准对象也可以传自定义对象)连用,常用于输出性质的组件,而对于输入性质的组件,若强行使用需要加[0],这种场景推荐使用<apex:variable>标签,来将比较长的api名称用变量存储。

15、15位Id与18位Id的区别?

C:Q:: what is the difference 18 digit id and 15digit?

Ans: When we create record in the object salesforce will create 18 digit unique to recognize it.

This is a case insensitive

Same 18 digit is represented as 15 digit id as case sensitive

Id 001—9000001—1o2Of in this 15/18 digit id first 3digits indicate Object and last 5 digits indicate record

16、两种方法获取组件id:
   a、{!$Component.idName} - eg.  var el1 = document.getElementById('{!$Component.name}').value;// 该方法不需要写嵌套的id,若要指明则:$Component.bk.age
   b、pg:fm:bk:name - eg. var el2 = document.getElementById('pg:fm:bk:name').value;// 该方法每个组件均需要指明id,并按嵌套关系依次书写,id间以:隔开
上述方法除在js中应用外也可用于css,若不指定id系统自动生成id,并在相对应组件中自动添加嵌套关系。
[plain]  view plain  copy
  1. <apex:page id="pg">  
  2.     <apex:form id="fm">  
  3.         <apex:inputText id="name" οnchange="show()"/>  
  4.         <script>  
  5.             function show() {  
  6.                 var el1 = document.getElementById('{!$Component.name}').value;  
  7.                 var el2 = document.getElementById('{!$Component.bk.age}').value;  
  8.                 alert('name: '+el1+', age: '+el2);  
  9.             }  
  10.             function demo() {  
  11.                 // getting specific dom element by this format, you shold write every level id.  
  12.                 var el1 = document.getElementById('pg:fm:name').value;  
  13.                 var el2 = document.getElementById('pg:fm:bk:age').value;  
  14.                 alert('name: '+el1+', age: '+el2);  
  15.             }  
  16.         </script>  
  17.         <apex:pageBlock id="bk">  
  18.             <apex:inputText id="age" οnchange="demo()"/>  
  19.             <apex:pageBlockSection id="bks1">  
  20.                 <apex:inputText id="ip1"/>  
  21.             </apex:pageBlockSection>  
  22.             <apex:pageBlockSection id="bks2">  
  23.                 <apex:inputText id="ip2"/>  
  24.                 <apex:outputText id="op"/>  
  25.             </apex:pageBlockSection>  
  26.             <apex:pageBlockButtons >  
  27.                 <apex:commandButton value="populateAutomaticly" οnclick="al()" oncomplete="populateAutomaticly()"/>  
  28.             </apex:pageBlockButtons>  
  29.             <script>  
  30.                 function populateAutomaticly() {  
  31.                     var el = document.getElementById('{!$Component.bks1.ip1}').value;  
  32.                     document.getElementById('pg:fm:bk:bks2:ip2').value = el;  
  33.                     document.getElementById('pg:fm:bk:bks2:op').innerHTML = el;  
  34.                 }  
  35.                 function al() {  
  36.                     alert('Testing...');  
  37.                 }  
  38.             </script>  
  39.         </apex:pageBlock>  
  40.     </apex:form>  
  41. </apex:page>  

17、apex:page组件与apex:sectionHeader组件属性的相互影响:
apex:page组件中比较少用到的属性:

<!--
setup="true";show sidebar as setup format;
renderAs="pdf";the body you development will show as pdf;
action="someMethods";excute the action first before render the page;
-->
<apex:sectionHeader title="Section Header Practice" subtitle="Home" description="draw your page using code" help="https://baidu.com" printUrl="https://baidu.com"/>
如果page中用到了setup="true"属性,那么sectionHeader中就不能显示对象图标。

18、创建visualforce的4种方法:
     a、导航法 - setup->developer->visualforce page;
     b、developer console;
   c、IDE - eg. sublime text / eclipes - 安装eclipes并配置forceIDE插件视频 - https://www.youtube.com/watch?v=ufe62nGecMg
    d、打开developer mode(两种方式:1. 在User里面-Edit-Development Mode;2. 在My Setting-Personal-Advanced User Details-Edit-Development Mode)后,通过url方式创建

19、 pageBlockTable中的 column组件设置宽度不生效 的解决方案:
    a、嵌套关系1: form>pageBlock>pageBlockTable>column,可以直接为column增加width的style或者styleClass,需要的话pageBlockTable设置个width:100%;

    b、嵌套关系2: form>pageBlock>pageBlockSection>pageBlockTable>column,这个时候添加style和styleClass是不生效的,此时只需要在pageBlockTable中设置columnsWidth="width1,width2...";

20、图解批准进程approval process,理解队列,多级审批:http://blog.csdn.net/itsme_web/article/details/732509

21、ApexPages.currentPage().getUrl().contains('st'),apex查看当前页面url是否包含某个字符串

22、Decimal.valueOf(ApexPages.currentPage().getParameters().get('st')),将字符串形式转换成Decimal格式

23、DateTime.getTime()获取时间戳,单位为ms;

24、使用apex处理日期:

[java]  view plain  copy
  1. DateTime nowTime = System.now();  
  2. String now_date = nowTime.format('yyyy-MM-dd');  
  3. String now_dateTime = nowTime.format('yyyy-MM-dd HH:mm:ss');  
  4. System.debug(now_date+'<------>'+now_dateTime);  
debug信息:
[plain]  view plain  copy
  1. 14:23:00:002 USER_DEBUG [4]|DEBUG|2017-07-26<------>2017-07-26 14:23:00 
25、 限制点击自定义按钮的简档:
[java]  view plain  copy
  1. /** 
  2.     功能说明:判别用户是否为项目比选相关专员 
  3.     参数说明:用户Id 
  4.     返回值:true/false 
  5.     作者:Wilson Xu 
  6.     日期:2017-07-26 
  7.     **/     
  8.     public static Boolean isValidUser(String userId){  
  9.         Set<String> profileSet = new Set<String>{'品牌专员','事件行销专员','物料制作专员','线上媒介专员','线下媒介专员','展览展示专员','子公司企划专员'};  
  10.         String profileName = [SELECT Profile.Name FROM User WHERE Id = :userId].Profile.Name;          
  11.         return profileSet.contains(profileName);  
  12.     }  
[java]  view plain  copy
  1. // 验证该用户是否为专员简档用户  
  2.         if(!isValidUser(UserInfo.getUserId())){  
  3.             result.code = '1';  
  4.             result.msg = '只有相关专员才能发起定向谈判!';   
  5.             return JSON.serialize(result);  
  6.         }  
26、Apex实例化一个内部类:

[java]  view plain  copy
  1. public class OuterClass {  
  2.     public class InnerClass {  
  3.         String name = '';  
  4.         Blob body = '';  
  5.     }  
  6. }  
  7. // 实例化内部类  
  8. OuterClass outer = new OuterClass();  
  9. OuterClass.InnerClass inner = new OuterClass.InnerClass();  
  10. /*接口类实例化*/  
  11. global class SyncInterface {      
  12.     // 封装数据结构 - 返回结果    
  13.     global class SyncResults{    
  14.         global List<Response> responses;    
  15.     }    
  16.         
  17.     global class Response{    
  18.         public String TYPE;    
  19.         public String MSG;    
  20.         public String BUSINESS_ID;    
  21.         public String SALESFORCE_ID;    
  22.         public String PROC_TYPE;                
  23.     }    
  24. }  
  25.   
  26. // 实例化接口response list  
  27. SyncResults syncResponseList = new SyncResults();    
  28. syncResponseList.responses = new List<Response>();  
27、使用Database.query()查询数据集合:
[java]  view plain  copy
  1. filterStr = 'AND Type__c = \'Text\' ';// 注意写成转义字符形式  
  2. query = 'SELECT Name, Type__c, Message__c, Msgpic__c, Mediaid__c, VioceRecognition__c, VoiceFormat__c, VoiceSrc__c ' +   
  3.         'FROM BD_CaseDetail__c ' +   
  4.         'WHERE Case__c = :caseId ' + filterStr + 'ORDER BY CreatedDate ASC LIMIT 500';  
  5. caseDetailList = Database.query(query);  
[java]  view plain  copy
  1. caseDetailList = [SELECT Name, Type__c, Message__c, Msgpic__c, Mediaid__c, VioceRecognition__c, VoiceFormat__c, VoiceSrc__c  
  2.                   FROM BD_CaseDetail__c  
  3.                   WHERE Case__c = :caseId AND Type__c = 'Text' ORDER BY CreatedDate ASC LIMIT 500]; 
28、 Live Agent 配置:

    1、先启用live agent - setup -> live agent settings -> enable

    2My Settings -> Advanced settings -> Live Agent User(勾选上)

29、根据自定义地理定位数据类型字段API名表示经纬度

现有API名称为:Geographic_Coordinates__c的地理位置坐标字段,要表示经度使用:Geographic_Coordinates__Longitude__s, 要表示纬度使用:Geographic_Coordinates__Latitude__s

[sql]  view plain  copy
  1. Select Id, Address__c, Geographic_Coordinates__Longitude__s, Geographic_Coordinates__Latitude__s From Store__c  

30、创建Task:

[java]  view plain  copy
  1. 任务:  
  2. Task task = new Task();  
  3. task.Subject = ‘A信息修改申请';  
  4. task.status = 'open';  
  5. task.priority = 'High';  
  6. task.whatId = '0017F00000CfcdsQAB';// 相关项目,这里是供应商Id  
  7. task.ownerId = '0057F000000pe6uQAA';// 被分配人,这里是UserId  
  8. // 以下两行是设置提醒  
  9. task.IsReminderSet = true;  
  10. task.ReminderDateTime = System.now();  
  11. insert task;  

31、Apex中List、Map、Set集合总结:
List:有序、可重复;
Map:无序,key重复则value覆盖;
Set:无序,不可重复;即使重复了,取前面的值,如:

[java]  view plain  copy
  1. Set<Integer> s = new Set<Integer> {1,2,3,2,1};  
  2. system.debug('s: ' + s);  
DEBUG INFO:s: {1,2,3}
Sample:
[java]  view plain  copy
  1. List<Account> accs = [select id, name from account limit 3];  
  2. map<Id, Account> m = new map<Id, Account>();  
  3. String lastId = '';  
  4. if(accs != null && !accs.isEmpty()) {  
  5.     Integer i = 0;  
  6.     for(Account a : accs) {  
  7.         System.debug('a['+i+'] : ' + a);  
  8.         lastId = a.Id;  
  9.         m.put(a.Id, a);  
  10.         i++;  
  11.     }  
  12. }  
  13. // 验证List有顺序,Map无顺序  
  14. System.debug(m);  
  15. System.debug(m.get(lastId));  
  16. Map<String, String> m1 = new Map<String, String> {  
  17.     'key1' => 'value1',  
  18.     'key2' => 'value2',  
  19.     'key1' => 'value2',  
  20.     'key2' => 'value3',    
  21.     'key1' => 'value3'  
  22. };  
  23. System.debug('m1: ' +m1);  
  24. System.debug('m1.key1: ' + m1.get('key1'));  

32、Partner User对Quote Tab不可见,Quote无Sharing Rule,它的共享受Opportunity的控制,如果对Partner User的Quote的OLS设置为View且Opportunity页面布局的Quote放出来了,如果共享Opp的Owner没有创建Quote记录,Partner User不可见Quote相关列表,需要创建一条Quote,才可以看见。

33、salesforce soql中不能对公式字段使用Group By;

34、封装Map<String, List<Sobject>>技巧 + 去重 | 参考资源:How to Send More than 10 E-mails

[java]  view plain  copy
  1. Map<Id, List<Case>> userCaseMap = new Map<Id, List<Case>>();  
  2. List<Case> allCaseLoggedToday = new List<Case>();  
  3. List<Id> salesIds = new List<Id>();  
  4. List<User> salesRep = [SELECT Id , Name , Email , ManagerId   
  5.                        FROM User   
  6.                        WHERE Profile.Name = 'System Administrator'];  
  7. for(User u : salesRep) {  
  8.   salesIds.add(u.Id);    
  9. }  
  10. allCaseLoggedToday = [SELECT Id, CaseNumber,CreatedById, Owner.Name , Account.Name , Contact.Name    
  11.                       FROM Case   
  12.                       WHERE CreatedDate = TODAY AND CreatedById in : salesIds];  
  13. for(Case c : allCaseLoggedToday) {  
  14.   if(userCaseMap.containsKey(c.CreatedById)) {  
  15.     //Fetch the list of case and add the new case in it  
  16.     List<Case> tempList = userCaseMap.get(c.CreatedById);  
  17.     tempList.add(c);  
  18.     //Putting the refreshed case list in map  
  19.     userCaseMap.put(c.CreatedById , tempList);  
  20.   }else {  
  21.     //Creating a list of case and outting it in map  
  22.     userCaseMap.put(c.CreatedById , new List<Case>{c});  
  23.   }  
  24. }  

35、使用apex获取IP地址ApexPages.currentPage().getHeaders().get('X-Salesforce-SIP');

36、在为输入元素赋初始值时,我们经常会使用url将参数写入该输入元素的Name属性,我们通常会担心,在Org迁移时,这些Name值是不是会改变,从而增加我们的维护负担?经调研,Vf画面的Name不会随着Org的改变而改变

37、Salesforce获取某个日期所在月份的天数

[java]  view plain  copy
  1. Date d = System.today();  
  2. Integer numberDays = date.daysInMonth(d.Year(), d.Month());  
  3. System.debug(numberDays);  

38、Salesforce布局特性:如果相关列表上无任何按钮,那么相关列表面板只有在有记录时才会显示

39、Lead Home Page调整经验之谈

    a、没有配置方法实现Home页面布局调整,比如将Tools和Reports换个位置

    b、无法用自定义报表链接替换Reports里面的标准报表链接-无法编辑标准报表无法将自定义报表移至Lead Reports        Folder;

     c、如果必须实现只能重写标准Lead Tab按钮

40、如果记录锁定,用户需要更新记录,则必须使用Webservice,比如:报价锁定非系统管理员需自动同步报价时,我们需要在Trigger里面调用Webservice,这时就需要使用到@future异步方式了。

41、Opportunity和Quote为Master-Detail关系,在导入历史数据时,Opportunity和Quote的Owner未同步,事后同步时,不可使用apex方法更新Quote Owner,错误信息为:"Can't change quote owner. Enable quotes without parent opportunities."。

42、System.debug('result: ' + rtMap.get(myRt).equals(qt.RecordTypeId) + '--qt.RecordTypeId: ' + qt.RecordTypeId + '--rtMap.get(myRt): ' + rtMap.get(myRt));Id为18位。

43、去重Sample - 看似怪诞,实则大有用处:

[java]  view plain  copy
  1. Map<String, String> accIDs = new Map<String,String>();  
  2. for(Quote qt: (List<Quote>)Trigger.New){  
  3.     if(!accIDs.containsKey(qt.Quote_To_Account__c))  
  4.         accIDs.put(qt.Quote_To_Account__c,'');  
  5. }  
  6. Map<String, Account> accs = new Map<String, Account>([SELECT id,BillingStreet,BillingCity, BillingState, BillingPostalCode, BillingCountry FROM Account WHERE Id IN : accIDs.keySet()]);  

44、启用或禁用内联编辑 - 有时候我们希望禁用用户默认的行内编辑功能,直接去user interface中将Enable Inline Editing关掉即可。

45、问题:System Administrator的Profile中Home的Tab Settings显示Default On,在Tab面板和Tab的customize列表中并没有看到Home?- 先禁用profile的enhanced profile user interface,之后在profile的Tab settings中勾上下图1,保存即可。
参见资料:https://help.salesforce.com/articleView?id=Home-Page-Tab-is-Missing-for-Users&language=en_US&type=1

46、在apex中启用记录锁来锁定或解锁记录

[html]  view plain  copy
  1. select count() from DTT__Geographic_Region__c  
[plain]  view plain  copy
  1. select count() from DTT__Geographic_Region__c  
[sql]  view plain  copy
  1. select count() from DTT__Geographic_Region__c  
[sql]  view plain  copy
  1. select count() from DTT__Geographic_Region__c  
[sql]  view plain  copy
  1. select count() from DTT__Geographic_Region__c  

47、如何配置实现超级管理员下次登录salesforce org不需要输入验证码:Profile -> System Administrator -> Login IP Ranges,设置IP Start Address:0.0.0.0,IP End Address:255.255.255.255即可。

48、使用Mavensmate同步DEV与UAT环境中简档的字段级别权限:在环境迁移时,部分元数据会存在丢失,导致两环境存在差异,比如简档中档FLS。

Step by Step】:先登陆到DEV环境,利用Mavensmate retrieve Profile和Custom Object(标准对象也在里面),然后勾选某对象如Order的fields和简档明细,点击Update后,在Sublime中打开文件;使用同样档方法将UAT相关文件下载到本地,然后直接复制粘贴简档文件档元数据覆盖UAT即可。


  • 1
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值