Monday, November 28, 2022
Wednesday, November 2, 2022
Salesforce Order of execution
Before Salesforce executes these events on the server, the browser runs JavaScript validation if the record contains any dependent picklist fields. The validation limits each dependent picklist field to its available values. No other validation occurs on the client side.
1. System Validation Rules.
2. Executes all before triggers.
3. Custom Validation rules.
4. Executes duplicate rules. If the duplicate rule identifies the record as a duplicate and uses the block action, the record is not saved and no further steps, such as after triggers and workflow rules, are taken.
5. Saves the record to the database, but doesn't commit yet.
6. Executes all after triggers.
7. Executes assignment rules.
8. Executes auto-response rules.
9.Executes workflow rules.
10. If there are workflow field updates, updates the record again.
11. If the record was updated with the workflow field update, it fires before and after triggers one more time (and only one more time) with standard validation rules. Custom validation rules, duplicate rules, and escalation rules are not run again.
Note:
If there were multiple field updates which updated the record, before and after triggers with standard validation rules will be fired only one time.
12. Executes processes and flows launched via processes and flow trigger workflow actions. When a process or flow executes a DML operation, the affected record goes through the save procedure.
13. Executes escalation rules.
14. Executes Entitlement Rules.
15. If the parent record is updated, and a grand-parent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Grand-parent record goes through save procedure.
16. If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure.
17. Executes Criteria Based Sharing evaluation.
18. Commits all DML operations to the database.
19. Executes post-commit logic, such as sending email.
Apex life hacks
Dynamic string formation: --> \'\' --> \'''\' --> \''+ +'\' --> \''+ test.Name +'\'
Query Custom Setting Records :
String regionQuery = 'SELECT Id, Name FROM TestCustomSetting__c';
List<TestCustomSetting__c> regionCustomSettings= Database.query(regionQuery);
Map<String, TestCustomSetting__c> countryMatrix = new Map<String, TestCustomSetting__c>();
for(TestCustomSetting__c region : regionCustomSettings){
countryMatrix .put(region.Name, region);
}
system.debug('countryToRegionTaskMatrix==>'+countryToRegionTaskMatrix);
https://www.infallibletechie.com/2012/10/map-datat-type-in-salesforce.html
https://salesforce.stackexchange.com/questions/223189/get-values-from-a-map-in-apex
SObject Query:
String typeName = 'Test__c';
SObjectType objectType = Schema.getGlobalDescribe().get(typeName);
Map<String,Schema.SObjectField> objectFields = objectType.getDescribe().fields.getMap();
String query = '';
Integer fieldCount = 0;
for (Schema.SObjectField objectField : objectFields.values()) {
if ('' + objectField != 'Test__c') {
query += objectField + ' ';
if ( fieldCount < objectFields.values().size() - 1) {
query += ', ';
}
}
fieldCount++;
}
system.debug('query==>'+query);
CSS Styling
Styling: 1. Inline Styling: < div style = "font-size: 2rem;font-weight: 400;" > Good Evening </ div > 2. Usi...
-
Sathis Myla salesforce: https://drive.google.com/drive/folders/15Vy6F8Kqqur9IdxHrK-SSiIATOiGnM7a Integration: https://drive.google.com/open?...
-
Salesforce Sample Rest API using Authentication: HTTPRequest r = new HTTPRequest(); r.setEndpoint('https://test.com'); ...
-
Styling: 1. Inline Styling: < div style = "font-size: 2rem;font-weight: 400;" > Good Evening </ div > 2. Usi...