20200219
- Setup -> Administration Setup -> Data Management -> Data Integration Rules>Geocodes for Account Billing Address
SELECT Id, Name, RecordTypeId, BillingStreet, BillingCity
, BillingState, BillingPostalCode, BillingCountry
, BillingStateCode, BillingCountryCode
, BillingLatitude, BillingLongitude, BillingGeocodeAccuracy
FROM Account
WHERE BillingGeocodeAccuracy!=null
Order by BillingCountryCode,BillingStateCode desc
Österreich-AT-Austria
Großbritannien-GB-United Kingdom
-
导入Account Team即可同步更新Account Share
-
导入Opportunity Team即可同步更新Opportunity Share
-
注意!!!dataloader取不到toLabel,workbench可以取到.
-
report type的使用
-
custom setting不支持picklist,custom metadata type支持picklist
-
format(stringToFormat, formattingArguments)
public static String format(String stringToFormat, List formattingArguments)
eg:
String template = ‘{0} was last updated {1}’;
List parameters = new List {‘Universal Containers’,DateTime.newInstance(2018, 11, 15) };
String formatted = String.format(template, parameters);
System.debug (‘Newly formatted string is:’ + formatted); -
知识体系是球形,而不是接近于T形
-
bug有可能来自salesforce,如发邮件状态Messaging.SendEmailResult为成功,但是无知原因导致未收到邮件。
邮件服务器原因?不开源,较小众。 -
我有一个不成熟的猜测,veeva通过代码有些用户发送的邮件收不到可能是由于没有用setTemplateId[滑稽][滑稽][滑稽]
-
生成PDF 的时候遇到报错了
1.如果用pdfPage.getContentAsPDF()只会报Internal Salesforce.com Error,
用pdfPage.getContent()就能catch error.
*** Error: common.apex.runtime.impl.ExecutionException: SObject row was retrieved via SOQL
without querying the requested field: Asset.VehicleVariant__c
2.pdf不加id是能够打开pdf的,加了之后后台也会报错的,所以应该优先看pdf是否正确,不一定需要走一遍流程。
后台也会报错的without querying the requested field: Asset.VehicleVariant__c
- 和生产进行比对,严谨起见
- 如果lightning页面打开速度太慢,用workbench查数据更快!
20200227
- Custom Setting and Custom Object 的后缀都是__c,导致同名报错 is already in use,这时感觉_mdt是多么的友善。
- Report filter 可以用 TODAY
- Metadata delete,then change set will delete this resource.
20200228
- file和document的区别:lightning不支持document
- file有contentVersion,contentDocument,contentWorkspace,主对象是content;而document则是document和folder。
20200303
- Tooling API
- Process Automation Settings> Deploy processes and flows as active.
You must opt in to deploy active processes and flows&test coverage as setted.
Sandbox可以看到 FlowTestCoverage吗?
Use Tooling API >checked,就可以查询到FlowTestCoverage。 - Get the names of all active autolaunched flows and processes that don’t have test coverage.
SELECT Definition.DeveloperName
FROM Flow
WHERE Status = ‘Active’
AND (ProcessType = ‘AutolaunchedFlow’ OR ProcessType = ‘Workflow’ OR ProcessType = ‘CustomEvent’ OR ProcessType = ‘InvocableProcess’)
AND Id NOT IN (SELECT FlowVersionId FROM FlowTestCoverage)
-
FlowDefinitionView
SELECT Id, DurableId, ApiName, Label, Description, ProcessType, TriggerType, NamespacePrefix
, ActiveVersionId, LatestVersionId, LastModifiedBy, IsActive FROM FlowDefinitionView
WHERE ApiName=‘ChangeNotification_RootProcess’ -
FlowTestCoverage
SELECT Id, ApexTestClassId, TestMethodName, FlowVersionId,FlowVersion.Definition.DeveloperName, NumElementsCovered, NumElementsNotCovered
FROM FlowTestCoverage
WHERE flowversionid=‘3019E000000kEevQAE’ -
NUMBER_OUTSIDE_VALID_RANGE, Fuel Level: value outside of valid range on numeric field: 99999: [LiquidLevel__c]
Case.Fuel Level是字段名;99999是该字段的赋值;LiquidLevel__c是API的名字。Percent(3,0)才是合理的范围。
20200309
- admin点击Reset Password是可以重新设密码的。
但是用户自己点login的Reset Password不可以重设密码,因为还没有初始化。
20200310
- picklist建议加toLabel(),改动更方便,可以只改label,不改api name。
20200313
- 以后一定要备份一份原始代码。方便追根溯源!万一有个代码丢失或者新旧代码比对也方便。代码管理真的很重要。特别是经常换开发人员的情况。
- dataloader不支持Nested Query,
workbench也不支持Nested Query,InvalidJob: Unable to find object: DCR_CV_Clinical_Work_Experience__r
20200317
-
Enable Enhanced Profile View :
Setup>Customize>User Management and then uncheck: Enable Enhanced Profile User Interface -
WSDL and SOAP APi
-
DataCategoryGroup:
-
Service Setup>data category group
-
object&field一起部署,object permission/tab/recordtype/layout这些权限在profile上,可以一起部署过去。但是package的field也会一起带上。所以,手动改object permission和user permission比较好一点。
真希望有个自动化部署的工具。
20200318
- Field is not writeable: Contract.EndDate
Contract Settings>uncheck the “Auto-calculate Contract End Date” box - Invalid type: NavigationMenuItemLocalization>enable Translation Workbench
20200319
- get objects map,include field name and label
//field name and label
map<String, Schema.SObjectField> map_name_field = Schema.getGlobalDescribe().get('Account').getDescribe().fields.getMap();
for (String name : map_name_field.keySet()) {
system.debug('name:'+map_name_field.get(name).getDescribe().getName());
system.debug('name:'+map_name_field.get(name).getDescribe().getLabel());
}
map_obj_fieldLabel.put('Account', getFieldLabels('Account'));
public static Map<String, String> getFieldLabels(String sObjectName) {
Map<String, String> map_apiName_label = new Map<String, String>();
if (String.isEmpty(sObjectName)) {
return null;
}
map <String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
Schema.SObjectType sobjType = gd.get(sObjectName);
if (sobjType == null) return null;
Schema.DescribeSObjectResult dsr = sobjType.getDescribe();
if (dsr == null) return null;
map<String, Schema.SObjectField> map_name_field = dsr.fields.getMap();
if (map_name_field == null || map_name_field.isEmpty()) return null;
for (String name : map_name_field.keySet()) {
map_apiName_label.put(map_name_field.get(name).getDescribe().getName(),
map_name_field.get(name).getDescribe().getLabel());
}
return map_apiName_label;
}
- get object permission
//object permission current user
Boolean isUpdateable = Schema.getGlobalDescribe().get('Account').getDescribe().isUpdateable();
System.debug('isUpdateable::' + isUpdateable);
20200414
- get Schema.ChildRelationship
for(Schema.ChildRelationship child : Account.SObjectType.getDescribe().getChildRelationships()){
if(child.getChildSObject()== Task.SObjectType)
System.debug('Account======>>>>>>>'+child);
}
-
给field加@AuraEnabled有什么用?
Use @AuraEnabled on Apex instance methods and properties to make them serializable when an instance of the class is
returned as data from a server-side action. -
后台测试throw Exception:
Any problem with dereferencing null, such as in the following code:
String s;
s.toLowerCase(); // Since s is null, this call causes a NullPointerException
20200416
- getCallback (function callback)
Returns a callback which is safe to invoke from outside Aura, e.g. as an event handler or in a setTimeout.
The $A.getCallback() call ensures that the framework rerenders the modified component and processes any enqueued actions.
Parameters
callback : function
The method to call after reestablishing Aura context.
不加$A.getCallback(function callback),会导致只有空闲时才callback,
就是F12打开控制台、切换页面、甚至单击页面时才callback,loading才消失!!!
- 统计VS的代码行数,包括空行、注释,正则表达式:
b*[^:b#/]+.*$
20200519
- Community User(Partner)
account>contact>login as a community user - Lead Convert ->Field Map(Object Manager>Lead>Fields & Relationships>Map Lead Fields)
Database.LeadConvertResult lcr = Database.convertLead(lc);
- Account & Person Account (Account+Contact)
Account-多人,B2B
Person Account-个体,B2C - lightning:path的更新可通过force:recordData>reloadRecord来实现刷新,通过重新加载record来刷新。
- checkAll的逻辑:
var mapCategory = {};
listChecklistItem.forEach(function(value, index, array) {
if(!Object.keys(mapCategory).includes(value.Category__c)) {
let category = {
Name : value.Category__c,
CheckAll : value.IsCompleted__c
}
mapCategory[value.Category__c] = category;
}else{
//if one is not completed,Check All need to off Status
console.log(mapCategory[value.Category__c]);
if(mapCategory[value.Category__c]['CheckAll'] && !value.IsCompleted__c){
let category = {
Name : value.Category__c,
CheckAll : false
}
mapCategory[value.Category__c] = category;
}
}
});
component.set("v.checklist", checklist);
component.set("v.listCategory", Object.values(mapCategory));
console.log(mapCategory);
- trigger framework,用以下方式来实例化,就可以实现调用virtual method!
Type.forName(String clsName).newInstance()
Base_Abs_TriggerDispatcher absTriggerDispatcher = (Base_Abs_TriggerDispatcher)Type.forName('Base_Abs_TriggerDispatcher').newInstance();
- 时间段重叠问题。
区间法思考,4种情况重叠(2相交,2包含),2种不重叠(反向思考,逆向思维,建议!)
不重叠取反,即:
startTime1 < endTime2 && endTime1 < startTime2 - Personal Setting:
Setting>Display>Set Default Record Types
Setting>Email>My Email Setting>Salesforce/Office365
20200602
建立本地git仓库,可以看到拉下来的代码和原来本地代码的Changes,棒!