| Salesforce Naming Conventions (Point and Click Tools) | 14 |||
|---|---|---|
| Component | 17 |Naming Convention | 18 |Example | 19 |
|
22 | Custom Object Name 23 | Custom Field Name 24 | Record Types 25 | Validation Rules 26 | Workflow Rules 27 | Approval Processes 28 | Custom Buttons & Links 29 | ...................... 30 | |
31 | CapitalizedCamelCase without Underscores | 32 |SalesOrder__c | 33 |
| Salesforce Naming Conventions (Apex) | 41 |||
|---|---|---|
| Component | 44 |Naming Convention | 45 |Examples with Suffix | 46 |
| Apex Trigger | 49 |CapitalizedCamelCase without Underscores | 50 |AccountTrigger | 51 |
| Apex Trigger Handler Class | 54 |CapitalizedCamelCase without Underscores | 55 |AccountTriggerHandler | 56 |
| Apex Utility Class | 59 |CapitalizedCamelCase without Underscores | 60 |AccountUtility | 61 |
| Apex Helper Class | 64 |CapitalizedCamelCase without Underscores | 65 |AccountRollupHelper | 66 |
| Apex Wrapper class | 69 |CapitalizedCamelCase without Underscores | 70 |AccountWrapper | 71 |
| Apex Batch Class | 74 |CapitalizedCamelCase without Underscores | 75 |ProcessAccountsBatch | 76 |
| Apex Schedule Class | 79 |CapitalizedCamelCase without Underscores | 80 |ProcessAccountsBatchSchedule | 81 |
| Apex/Visualforce Controller | 84 |CapitalizedCamelCase without Underscores | 85 |AccountController | 86 |
| Apex/Visualforce Controller Extension | 89 |CapitalizedCamelCase without Underscores | 90 |AccountControllerExtension | 91 |
| Apex Test Data Factory | 94 |CapitalizedCamelCase without Underscores | 95 |AccountTestDataFactory | 96 |
| Apex Test Class Name | 99 |CapitalizedCamelCase without Underscores | 100 |AccountTest | 101 |
| Apex Class Method | 104 |lowerCamelCase without Underscores | 105 |public void calculateSales(){} | 106 |
| Apex Constant Class Variables | 109 |CAPITALIZED_WITH_UNDERSCORES | 110 |public static final OBJECT_TYPE_ACCOUNT = ‘Account’; | 111 |
| Boolean Variables | 114 |lowerCamelCase without Underscores | 115 |isActive, hasErrors, hasLineItems, isSuccess etc. | 116 |
| Salesforce Naming Conventions (Visualforce / Static Resource / Custom Labels) | 124 |||
|---|---|---|
| Component | 127 |Naming Convention | 128 |Examples with Suffix | 129 |
| Visualforce Page | 132 |CapitalizedCamelCase without Underscores | 133 |ViewSales | 134 |
| Static Resources | 137 |lowerCamelCase without Underscores | 138 |paginationResource | 139 |
| Custom Label | 142 |CapitalizedCamelCase without Underscores | 143 |ErrorMessage | 144 |
| Salesforce Naming Conventions (Lightning) | 152 |||
|---|---|---|
| Component | 155 |Naming Convention | 156 |Examples with Suffix | 157 |
| Lightning Application | 160 |CapitalizedCamelCase without Underscores | 161 |HRMApp | 162 |
| Lightning Interface | 165 |CapitalizedCamelCase without Underscores | 166 |PaginationInterface | 167 |
| Lightning Component | 170 |lowerCamelCase without Underscores | 171 |processRecordsComponent | 172 |
| Lightning Token | 175 |lowerCamelCase without Underscores | 176 |integrationCredentialsToken | 177 |
| Lightning Application Event | 180 |lowerCamelCase with Underscores | 181 |deleteRecord_AppEvent | 182 |
| Lightning Component Event | 185 |lowerCamelCase with Underscores | 186 |sendAccountToSAP_CompEvent | 187 |
| Acceptable Keywords & Access Modifiers (Y) | 195 ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Class Type | 198 |global | 199 |public | 200 |private | 201 |with sharing | 202 |without sharing | 203 |@isTest annotation | 204 |@testSetup annotation | 205 |@TestVisible annotation | 206 |@AuraEnabled annotation | 207 |||
| Apex Constant Class | 210 |211 | | Y | 212 |213 | | Y | 214 |215 | | 216 | | 217 | | 218 | | 219 | | ||
| Apex Trigger Handler | 222 |223 | | Y | 224 |225 | | Y | 226 |227 | | 228 | | 229 | | 230 | | 231 | | ||
| Apex Utility | 234 |235 | | Y | 236 |237 | | Y | 238 |Y | 239 |240 | | 241 | | 242 | | 243 | | ||
| Apex Helper | 246 |247 | | Y | 248 |249 | | Y | 250 |Y | 251 |252 | | 253 | | 254 | | 255 | | ||
| Apex Schedule | 258 |Y | 259 |260 | | 261 | | Y | 262 |263 | | 264 | | 265 | | 266 | | 267 | | ||
| Apex Batch | 270 |Y | 271 |272 | | 273 | | Y | 274 |275 | | 276 | | 277 | | 278 | | 279 | | ||
| Apex Wrapper | 282 |283 | | Y | 284 |285 | | Y | 286 |287 | | 288 | | 289 | | 290 | | 291 | | ||
| Visualforce Controller | 294 |295 | | Y | 296 |297 | | Y | 298 |299 | | 300 | | 301 | | 302 | | 303 | | ||
| Visualforce Controller Extension | 306 |307 | | Y | 308 |309 | | Y | 310 |311 | | 312 | | 313 | | 314 | | 315 | | ||
| Lightning Controller | 318 |319 | | Y | 320 |321 | | Y | 322 |323 | | 324 | | 325 | | 326 | | Y | 327 |||
| Apex Test Data Factory | 330 |331 | | Y | 332 |333 | | 334 | | 335 | | Y | 336 |337 | | 338 | | 339 | | ||
| Apex Test Class | 342 |343 | | 344 | | Y | 345 |346 | | 347 | | Y | 348 |349 | | 350 | | 351 | | ||
| Apex Non-Test Class Private Variables | 354 |355 | | 356 | | Y | 357 |358 | | 359 | | 360 | | 361 | | Y | 362 |363 | | ||
| Apex Non-Test Class Private Methods | 366 |367 | | 368 | | Y | 369 |370 | | 371 | | 372 | | 373 | | Y | 374 |375 | | ||
| Apex Setup / Common Method | 378 |379 | | 380 | | 381 | | 382 | | 383 | | Y | 384 |Y | 385 |386 | | 387 | | ||
| Custom Settings | 395 |||
|---|---|---|
| Component | 398 |Best Practice | 399 |Examples | 400 |
| List Custom Settings in Apex | 403 |Don't use SOQL Query to access custom setting. Use following List custom setting methods to access it. 404 | (1) getAll() 405 | (2) getInstance(dataSetName) 406 | (3) getValues(dataSetName) 407 | |
408 | (1) Get all records of a custom setting 409 |
410 | Map
416 | (2) Get specific record from the custom setting using literal 417 |
418 | TriggerSetting_c accountTriggerSetting = TriggerSetting_c.getInstance('Account');
419 | System.Debug('>>accountTriggerSetting<<'+accountTriggerSetting);
420 | System.Debug('>>accountTriggerSetting<<'+accountTriggerSetting.Deactivate__c);
421 |
422 | (3) Get specific record from the custom setting using literal 423 |
424 | TriggerSetting_c accountTriggerSetting = TriggerSetting_c.getValues('Account');
425 | System.Debug('>>accountTriggerSetting<<'+accountTriggerSetting);
426 | System.Debug('>>accountTriggerSetting<<'+accountTriggerSetting.Deactivate__c);
427 |
428 | |
429 |
| Hierarchy Custom Setting in Apex | 432 |Don't use SOQL Query to access custom setting. Use following Hierarchy custom setting methods to access it. 433 | (1) getInstance() 434 | (2) getInstance(userId) 435 | (3) getInstance(profileId) 436 | (4) getOrgDefaults() 437 | (5) getValues(userId) 438 | (6) getValues(profileId) 439 | |
440 | (1) 441 |
442 | TPM_ApplicationSetting_c applicationSetting = TPM_ApplicationSetting_c.getOrgDefaults();
443 | System.Debug('>>applicationSetting<<'+applicationSetting);
444 | System.Debug('>>applicationSetting<<'+applicationSetting.TPM_RecordsPerPage__c);
445 | if( applicationSetting.TPM_RecordsPerPage__c <> null ){
446 | // Your code here...
447 | }
448 |
449 | (2) 450 |
451 | TPM_ApplicationSetting_c applicationSetting = TPM_ApplicationSetting_c.getInstance();
452 | System.Debug('>>applicationSetting<<'+applicationSetting);
453 | System.Debug('>>applicationSetting<<'+applicationSetting.TPM_RecordsPerPage__c);
454 | if( applicationSetting.TPM_RecordsPerPage__c <> null ){
455 | // Your code here...
456 | }
457 |
458 | |
459 |
| Custom Metadata Types | 467 |||
|---|---|---|
| Best Practice | 470 |Examples | 471 ||
| Use SOQL query to access Custom Metadata Type record | 474 |(1) Access All records 475 |
476 | List
478 | (2) Access specific record 479 |
480 | TPM_KPIConfiguration__mdt kpiConfiguration = [SELECT MasterLabel, QualifiedApiName, DeveloperName, TPM_Active__c FROM TPM_KPIConfiguration__mdt WHERE QualifiedApiName = 'WaveAnalytics1'];
481 |
482 | |
483 | |
505 |
506 |
507 |
508 |
509 |
510 | ## Transaction Control in Apex (Savepoint & Rollback)
511 |
512 | ```
513 | public PageReference saveAccounts(){
514 |
515 | Savepoint sp = Database.setSavepoint();
516 |
517 | try{
518 | // Your code logic here...
519 | }
520 | catch(System.Exception ex){
521 |
522 | Database.rollback(sp);
523 |
524 | // Show error to user
525 | }
526 |
527 | return null;
528 |
529 | }
530 | ```
531 |
532 | ## Salesforce Trailmixes
533 | (1) Learn Salesforce with Trailhead