├── .forceignore ├── .gitignore ├── README.md ├── config └── project-scratch-def.json ├── force-app └── main │ └── default │ ├── classes │ ├── ITriggerExtension.cls │ ├── ITriggerExtension.cls-meta.xml │ ├── TestLeadActions.cls │ ├── TestLeadActions.cls-meta.xml │ ├── TriggerExtensionSupport.cls │ ├── TriggerExtensionSupport.cls-meta.xml │ ├── dynamicTaskTriggerHandler.cls │ ├── dynamicTaskTriggerHandler.cls-meta.xml │ ├── simpleLeadUpdater.cls │ ├── simpleLeadUpdater.cls-meta.xml │ ├── taskSetStatus.cls │ ├── taskSetStatus.cls-meta.xml │ ├── taskTrackCount.cls │ └── taskTrackCount.cls-meta.xml │ ├── customMetadata │ └── Dynamic_Trigger.Dynamic_task.md-meta.xml │ ├── flows │ ├── FollowUpOnRealAccounts.flow-meta.xml │ └── Set_First_Owner_Worked.flow-meta.xml │ ├── layouts │ ├── Dynamic_Trigger__mdt-Dynamic Trigger Layout.layout-meta.xml │ ├── Lead-Lead %28Marketing%29 Layout.layout-meta.xml │ ├── Lead-Lead %28Sales%29 Layout.layout-meta.xml │ ├── Lead-Lead %28Support%29 Layout.layout-meta.xml │ └── Lead-Lead Layout.layout-meta.xml │ ├── objects │ ├── Activity │ │ └── fields │ │ │ └── Declarative_Created__c.field-meta.xml │ ├── Dynamic_Trigger__mdt │ │ ├── Dynamic_Trigger__mdt.object-meta.xml │ │ └── fields │ │ │ ├── Class_Name__c.field-meta.xml │ │ │ ├── Object_Type__c.field-meta.xml │ │ │ └── Priority__c.field-meta.xml │ └── Lead │ │ └── fields │ │ ├── Bypass_Declarative__c.field-meta.xml │ │ ├── First_Owner_Worked__c.field-meta.xml │ │ └── Task_Count__c.field-meta.xml │ ├── standardValueSets │ └── LeadStatus.standardValueSet-meta.xml │ ├── triggers │ ├── leadTriggerSetFollowup.trigger │ ├── leadTriggerSetFollowup.trigger-meta.xml │ ├── taskTrigger.trigger │ └── taskTrigger.trigger-meta.xml │ └── workflows │ └── Lead.workflow-meta.xml └── sfdx-project.json /.forceignore: -------------------------------------------------------------------------------- 1 | # List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status 2 | # More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm 3 | # 4 | 5 | package.xml 6 | force-app/main/default/profiles 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .sfdx 2 | .vscode 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # SFDX App 3 | 4 | This is the sample respository for the course: 5 | Play by Play: Adopting Trigger Design Patterns in Existing Salesforce Orgs 6 | 7 | ## Dev, Build and Test 8 | 9 | Each commit represents a step in the course. Checkout individual commits to follow along 10 | 11 | ## Resources 12 | 13 | 14 | ## Description of Files and Directories 15 | 16 | 17 | ## Issues 18 | 19 | Refer to the course for specific descriptions of the various methods and processes. 20 | The following notes also apply: 21 | 22 | - leadTriggerSetFollowup makes sure any lead inserted or updated to "Working - Contacted" has a Lead Followup task created. 23 | 24 | - taskTriggerSetStatus looks for task insertion where the task references a lead. When it does, if the lead is "Open - Not Contacted", the lead status is set to "Working - Contacted". If the lead status is "Working - Contacted" it is set to "Working Harder" 25 | 26 | - taskTriggerTrackCount - updates the task count on leads when tasks are inserted, deleted, updated 27 | 28 | - Process follow-up on lead accounts checks for leads created with emails other than gmail, hotmail and yahoo. It creates for them a Lead Followup task. 29 | 30 | - Process first owner worked checks for leads with a user owner and a status that starts with working - updates the first owner worked field to the user 31 | 32 | - Steps: 33 | 1. Change process follow-up on lead accounts to set additional field so taskTriggerSetStatus can be bypassed. 34 | 2. Bypass first owner worked process if status is changed due to task being created on a lead 35 | 3. Combine field updates on taskTriggerTrackCount and taskTriggersetStatus 36 | -------------------------------------------------------------------------------- /config/project-scratch-def.json: -------------------------------------------------------------------------------- 1 | { 2 | "orgName": "Triggers without frameworks", 3 | "edition": "Developer", 4 | "hasSampleData": "true", 5 | "orgPreferences" : { 6 | "enabled": ["S1DesktopEnabled"] 7 | }, 8 | "features" : ["AuthorApex","CustomApps","CustomTabs"] 9 | 10 | } 11 | -------------------------------------------------------------------------------- /force-app/main/default/classes/ITriggerExtension.cls: -------------------------------------------------------------------------------- 1 | public interface ITriggerExtension { 2 | void HandleTrigger(TriggerOperation operationType, 3 | List newList, List oldList, 4 | Map newMap, Map oldMap ) ; 5 | } 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/ITriggerExtension.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 44.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/TestLeadActions.cls: -------------------------------------------------------------------------------- 1 | @istest 2 | public with sharing class TestLeadActions { 3 | 4 | @istest 5 | public static void TestInsertSingleLead() { 6 | Test.startTest(); 7 | InsertLeads(1, 'Open - Not Contacted'); 8 | Test.stopTest(); 9 | } 10 | 11 | @istest static void TestInsertBulkLead() 12 | { 13 | Long startTime = DateTime.now().getTime(); 14 | Long startCPU = Limits.getCpuTime(); 15 | Test.startTest(); 16 | InsertLeads(200, 'Open - Not Contacted'); 17 | Test.stopTest(); 18 | system.debug('Elapsed: ' + (Datetime.Now().getTime()- startTime)); 19 | system.debug('Elapsed CPU: ' + (Limits.getCpuTime() - startCPU)); 20 | } 21 | 22 | 23 | public static void InsertLeads(Integer count, String leadstatus) 24 | { 25 | List leadsToInsert = new List(); 26 | for(Integer x = 0; x leads = [Select ID, Status from Lead]; 41 | for(Lead ld: leads) 42 | ld.status = 'Working - Contacted'; 43 | Test.startTest(); 44 | update leads; 45 | } 46 | 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /force-app/main/default/classes/TestLeadActions.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 44.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/TriggerExtensionSupport.cls: -------------------------------------------------------------------------------- 1 | public with sharing class TriggerExtensionSupport { 2 | 3 | public static List getTriggerClasses(String objectType) 4 | { 5 | List triggerSettings = 6 | [Select Class_Name__c from Dynamic_Trigger__mdt 7 | where Object_Type__c = :objectType 8 | Order By Priority__c Asc]; 9 | List results = new List(); 10 | 11 | for(Dynamic_Trigger__mdt setting: triggerSettings) 12 | { 13 | System.Type thetype = Type.forName(setting.Class_Name__c); 14 | if(thetype==null) thetype = Type.forName('',setting.Class_Name__c); // Try resolving local class 15 | if(thetype!=null) 16 | { 17 | Object theobject = thetype.newInstance(); 18 | if(theobject instanceof ITriggerExtension) results.add((ITriggerExtension)theobject); 19 | } 20 | 21 | } 22 | return results; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /force-app/main/default/classes/TriggerExtensionSupport.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 44.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/dynamicTaskTriggerHandler.cls: -------------------------------------------------------------------------------- 1 | public with sharing class dynamicTaskTriggerHandler implements ITriggerExtension { 2 | 3 | public void HandleTrigger(TriggerOperation operationType, 4 | List newList, List oldList, 5 | Map newMap, Map oldMap ) 6 | { 7 | system.debug('Trigger extension was called'); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /force-app/main/default/classes/dynamicTaskTriggerHandler.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 44.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/simpleLeadUpdater.cls: -------------------------------------------------------------------------------- 1 | public with sharing class simpleLeadUpdater { 2 | 3 | Map leadsToUpdate = new Map(); 4 | 5 | public Lead getLead(ID leadID) 6 | { 7 | Lead targetLead = leadsToUpdate.get(leadID); 8 | if(targetLead == null) 9 | { 10 | targetLead = new Lead(ID = leadID); 11 | leadsToUpdate.put(leadID, targetLead); 12 | } 13 | return targetLead; 14 | } 15 | 16 | public void updateLeads() 17 | { 18 | if(leadsToUpdate.size()>0) update leadsToUpdate.values(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /force-app/main/default/classes/simpleLeadUpdater.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 44.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/taskSetStatus.cls: -------------------------------------------------------------------------------- 1 | public with sharing class taskSetStatus { 2 | 3 | private static Set statusUpdated = new Set(); 4 | 5 | public static void handleTrigger(List newTasks, simpleLeadUpdater leadUpdater) { 6 | // When a task referencing a lead is created, look at it's status. 7 | // If 'Open - Not Contacted', set it to 'Working - Contacted' 8 | // If 'Working - Contacted', set it to 'Working - Harder' 9 | 10 | Set leadIds = new Set(); 11 | 12 | for(Task t: newTasks) 13 | { 14 | if(t.whoId!=null && t.whoID.getSObjectType()==Schema.Lead.SObjectType && 15 | !t.Declarative_Created__c) leadIds.add(t.whoId); 16 | } 17 | 18 | List leads = [Select ID, Status from Lead where ID in :leadIds]; 19 | for(Lead ld: leads) 20 | { 21 | if(statusUpdated.contains(ld.id)) continue; // Skip those already updated 22 | 23 | system.debug('taskTriggerSetStatus current lead status: ' + ld.status + ' lead: ' + lead.id); 24 | 25 | switch on ld.status 26 | { 27 | when 'Open - Not Contacted' 28 | { 29 | Lead toUpdate = leadUpdater.getLead(ld.id); 30 | toUpdate.status = 'Working - Contacted'; 31 | statusUpdated.add(ld.id); 32 | system.debug('taskTriggerSetStatus setting lead status to ' + toupdate.status + ' lead: ' + lead.id); 33 | } 34 | 35 | when 'Working - Contacted' { 36 | Lead toUpdate = leadUpdater.getLead(ld.id); 37 | toUpdate.status = 'Working Harder'; 38 | statusUpdated.add(ld.id); 39 | system.debug('taskTriggerSetStatus setting lead status to ' + toUpdate.status + ' lead: ' + lead.id); 40 | } 41 | } 42 | } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /force-app/main/default/classes/taskSetStatus.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 44.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/classes/taskTrackCount.cls: -------------------------------------------------------------------------------- 1 | public with sharing class taskTrackCount { 2 | 3 | public static void handleTrigger(TriggerOperation operationType, List newList, list oldList, simpleLeadUpdater leadUpdater) 4 | { 5 | Set leadIds = new Set(); 6 | 7 | if( operationType == TriggerOperation.AFTER_UPDATE || 8 | operationType == TriggerOperation.AFTER_INSERT) 9 | { 10 | for(Task t: newList) 11 | { 12 | if(t.whoId!=null && t.whoID.getSObjectType()==Schema.Lead.SObjectType) leadIds.add(t.whoId); 13 | } 14 | } 15 | if( operationType == TriggerOperation.AFTER_UPDATE || 16 | operationType == TriggerOperation.AFTER_DELETE) 17 | { 18 | for(Task t: oldList) 19 | { 20 | if(t.whoId!=null && t.whoID.getSObjectType()==Schema.Lead.SObjectType) leadIds.add(t.whoId); 21 | } 22 | 23 | } 24 | 25 | List leads = [Select ID, Task_Count__c from Lead where ID in :leadIds]; 26 | 27 | List tasks = [Select Count(ID) items, WhoId from Task where WhoId in :leadIds group by WhoID]; 28 | Map taskCounts = new Map(); 29 | 30 | for(AggregateResult ar: tasks) 31 | { 32 | taskCounts.put((ID)ar.get('WhoId'), (Integer)ar.get('items')); 33 | } 34 | 35 | for(Lead ld: leads) 36 | { 37 | if(ld.Task_Count__c != taskCounts.get(ld.Id)) 38 | { 39 | Lead toUpdate = leadUpdater.getLead(ld.id); 40 | toUpdate.Task_Count__c = taskCounts.get(ld.id); 41 | system.debug('taskTriggerTrackCount changing task count to ' + toUpdate.Task_Count__c + ' lead: ' + ld.id); 42 | } 43 | } 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /force-app/main/default/classes/taskTrackCount.cls-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 44.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/customMetadata/Dynamic_Trigger.Dynamic_task.md-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | Class_Name__c 7 | dynamicTaskTriggerHandler 8 | 9 | 10 | Object_Type__c 11 | Task 12 | 13 | 14 | Priority__c 15 | 5.0 16 | 17 | 18 | -------------------------------------------------------------------------------- /force-app/main/default/flows/FollowUpOnRealAccounts.flow-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | myVariable_waitStartTimeAssignment 5 | 6 | 0 7 | 0 8 | 9 | myVariable_waitStartTimeVariable 10 | Assign 11 | 12 | $Flow.CurrentDateTime 13 | 14 | 15 | 16 | myDecision 17 | 18 | 19 | 20 | 21 | index 22 | 23 | 0.0 24 | 25 | 26 | myDecision 27 | 28 | 50 29 | 0 30 | default 31 | 32 | myRule_1 33 | and 34 | 35 | formula_myRule_1 36 | EqualTo 37 | 38 | true 39 | 40 | 41 | 42 | myRule_1_pmetdec 43 | 44 | 45 | 46 | 47 | 48 | myRule_1_pmetdec 49 | 50 | 100 51 | 100 52 | 53 | myRule_1_A1 54 | 55 | Not Previously Met 56 | 57 | myRule_1_pmetnullrule 58 | or 59 | 60 | myVariable_old 61 | IsNull 62 | 63 | true 64 | 65 | 66 | 67 | myRule_1_A1 68 | 69 | 70 | 71 | 72 | myRule_1_pmetrule 73 | and 74 | 75 | formula_myRule_1_pmetrule 76 | EqualTo 77 | 78 | true 79 | 80 | 81 | 82 | 83 | 84 | If a non-junk Email is entered, create a follow-up task 85 | 86 | 87 | originalFormula 88 | 89 | $User.Id 90 | 91 | 92 | formula_2_myRule_1_A1_0743918911 93 | String 94 | {!$User.Id} 95 | 96 | 97 | 98 | originalFormula 99 | 100 | NOT( ISBLANK( [Lead].Email) && CONTAINS('gmail.com,hotmail.com,yahoo.com', [Lead].Email) ) && 101 | (ISNEW() && [Lead].Bypass_Declarative__c=0 || 102 | NOT(ISNEW()) && NOT(ISCHANGED( [Lead].Bypass_Declarative__c )) ) 103 | 104 | 105 | formula_myRule_1 106 | Boolean 107 | NOT( ISBLANK( {!myVariable_current.Email}) && CONTAINS('gmail.com,hotmail.com,yahoo.com', {!myVariable_current.Email}) ) && 108 | (ISNEW() && {!myVariable_current.Bypass_Declarative__c}=0 || 109 | NOT(ISNEW()) && NOT(ISCHANGED( {!myVariable_current.Bypass_Declarative__c} )) ) 110 | 111 | 112 | 113 | originalFormula 114 | 115 | NOT( ISBLANK( [Lead].Email) && CONTAINS('gmail.com,hotmail.com,yahoo.com', [Lead].Email) ) && 116 | (ISNEW() && [Lead].Bypass_Declarative__c=0 || 117 | NOT(ISNEW()) && NOT(ISCHANGED( [Lead].Bypass_Declarative__c )) ) 118 | 119 | 120 | formula_myRule_1_pmetrule 121 | Boolean 122 | NOT( ISBLANK( {!myVariable_old.Email}) && CONTAINS('gmail.com,hotmail.com,yahoo.com', {!myVariable_old.Email}) ) && 123 | (ISNEW() && {!myVariable_old.Bypass_Declarative__c}=0 || 124 | NOT(ISNEW()) && NOT(ISCHANGED( {!myVariable_old.Bypass_Declarative__c} )) ) 125 | 126 | FollowUpOnRealAccounts-4_InterviewLabel 127 | 128 | 129 | ObjectType 130 | 131 | Lead 132 | 133 | 134 | 135 | ObjectVariable 136 | 137 | myVariable_current 138 | 139 | 140 | 141 | OldObjectVariable 142 | 143 | myVariable_old 144 | 145 | 146 | 147 | TriggerType 148 | 149 | onAllChanges 150 | 151 | 152 | Workflow 153 | 154 | myRule_1_A1 155 | 156 | 100 157 | 200 158 | 159 | 160 | dataType 161 | 162 | Boolean 163 | 164 | 165 | 166 | isRequired 167 | 168 | false 169 | 170 | 171 | 172 | leftHandSideLabel 173 | 174 | Declarative Created 175 | 176 | 177 | 178 | leftHandSideReferenceTo 179 | 180 | 181 | 182 | 183 | 184 | rightHandSideType 185 | 186 | Boolean 187 | 188 | 189 | Declarative_Created__c 190 | 191 | true 192 | 193 | 194 | 195 | 196 | dataType 197 | 198 | String 199 | 200 | 201 | 202 | isRequired 203 | 204 | false 205 | 206 | 207 | 208 | leftHandSideLabel 209 | 210 | Description 211 | 212 | 213 | 214 | leftHandSideReferenceTo 215 | 216 | 217 | 218 | 219 | 220 | rightHandSideType 221 | 222 | String 223 | 224 | 225 | Description 226 | 227 | Check lead for major account status 228 | 229 | 230 | 231 | 232 | dataType 233 | 234 | ID 235 | 236 | 237 | 238 | isRequired 239 | 240 | false 241 | 242 | 243 | 244 | leftHandSideLabel 245 | 246 | Assigned To ID 247 | 248 | 249 | 250 | rightHandSideType 251 | 252 | Formula 253 | 254 | 255 | OwnerId 256 | 257 | formula_2_myRule_1_A1_0743918911 258 | 259 | 260 | 261 | 262 | dataType 263 | 264 | Picklist 265 | 266 | 267 | 268 | isRequired 269 | 270 | false 271 | 272 | 273 | 274 | leftHandSideLabel 275 | 276 | Priority 277 | 278 | 279 | 280 | rightHandSideType 281 | 282 | Picklist 283 | 284 | 285 | Priority 286 | 287 | Normal 288 | 289 | 290 | 291 | 292 | dataType 293 | 294 | Picklist 295 | 296 | 297 | 298 | isRequired 299 | 300 | false 301 | 302 | 303 | 304 | leftHandSideLabel 305 | 306 | Status 307 | 308 | 309 | 310 | rightHandSideType 311 | 312 | Picklist 313 | 314 | 315 | Status 316 | 317 | Not Started 318 | 319 | 320 | 321 | 322 | dataType 323 | 324 | String 325 | 326 | 327 | 328 | isRequired 329 | 330 | false 331 | 332 | 333 | 334 | leftHandSideLabel 335 | 336 | Subject 337 | 338 | 339 | 340 | leftHandSideReferenceTo 341 | 342 | 343 | 344 | 345 | 346 | rightHandSideType 347 | 348 | String 349 | 350 | 351 | Subject 352 | 353 | Lead followup 354 | 355 | 356 | 357 | 358 | dataType 359 | 360 | ID 361 | 362 | 363 | 364 | isRequired 365 | 366 | false 367 | 368 | 369 | 370 | leftHandSideLabel 371 | 372 | Name ID 373 | 374 | 375 | 376 | leftHandSideReferenceTo 377 | 378 | Contact;Lead 379 | 380 | 381 | 382 | rightHandSideType 383 | 384 | Reference 385 | 386 | 387 | WhoId 388 | 389 | myVariable_current.Id 390 | 391 | 392 | Task 393 | 394 | myVariable_waitStartTimeAssignment 395 | Active 396 | 397 | myVariable_current 398 | SObject 399 | false 400 | true 401 | true 402 | Lead 403 | 404 | 405 | myVariable_old 406 | SObject 407 | false 408 | true 409 | false 410 | Lead 411 | 412 | 413 | myVariable_waitStartTimeVariable 414 | DateTime 415 | false 416 | false 417 | false 418 | 419 | $Flow.CurrentDateTime 420 | 421 | 422 | 423 | -------------------------------------------------------------------------------- /force-app/main/default/flows/Set_First_Owner_Worked.flow-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | myVariable_waitStartTimeAssignment 5 | 6 | 0 7 | 0 8 | 9 | myVariable_waitStartTimeVariable 10 | Assign 11 | 12 | $Flow.CurrentDateTime 13 | 14 | 15 | 16 | myDecision 17 | 18 | 19 | 20 | 21 | index 22 | 23 | 0.0 24 | 25 | 26 | myDecision 27 | 28 | 50 29 | 0 30 | default 31 | 32 | myRule_1 33 | and 34 | 35 | formula_myRule_1 36 | EqualTo 37 | 38 | true 39 | 40 | 41 | 42 | myRule_1_A1 43 | 44 | 45 | 46 | 47 | Set first owner worked field 48 | 49 | 50 | originalFormula 51 | 52 | ISBLANK( [Lead].First_Owner_Worked__c ) && BEGINS(CASESAFEID( [Lead].OwnerId ), '005') && BEGINS(TEXT([Lead].Status),'Working') 53 | 54 | 55 | formula_myRule_1 56 | Boolean 57 | ISBLANK( {!myVariable_current.First_Owner_Worked__c} ) && BEGINS(CASESAFEID( {!myVariable_current.OwnerId} ), '005') && BEGINS(TEXT({!myVariable_current.Status}),'Working') 58 | 59 | Set_First_Owner_Worked-1_InterviewLabel 60 | 61 | 62 | ObjectType 63 | 64 | Lead 65 | 66 | 67 | 68 | ObjectVariable 69 | 70 | myVariable_current 71 | 72 | 73 | 74 | OldObjectVariable 75 | 76 | myVariable_old 77 | 78 | 79 | 80 | TriggerType 81 | 82 | onAllChanges 83 | 84 | 85 | Workflow 86 | 87 | 88 | evaluationType 89 | 90 | always 91 | 92 | 93 | 94 | isChildRelationship 95 | 96 | false 97 | 98 | 99 | 100 | reference 101 | 102 | [Lead] 103 | 104 | 105 | myRule_1_A1 106 | 107 | 100 108 | 200 109 | 110 | 111 | implicit 112 | 113 | true 114 | 115 | 116 | Id 117 | EqualTo 118 | 119 | myVariable_current.Id 120 | 121 | 122 | 123 | 124 | dataType 125 | 126 | ID 127 | 128 | 129 | 130 | isRequired 131 | 132 | false 133 | 134 | 135 | 136 | leftHandSideLabel 137 | 138 | First Owner Worked 139 | 140 | 141 | 142 | leftHandSideReferenceTo 143 | 144 | User 145 | 146 | 147 | 148 | rightHandSideType 149 | 150 | Reference 151 | 152 | 153 | First_Owner_Worked__c 154 | 155 | myVariable_current.OwnerId 156 | 157 | 158 | Lead 159 | 160 | myVariable_waitStartTimeAssignment 161 | Active 162 | 163 | myVariable_current 164 | SObject 165 | false 166 | true 167 | true 168 | Lead 169 | 170 | 171 | myVariable_old 172 | SObject 173 | false 174 | true 175 | false 176 | Lead 177 | 178 | 179 | myVariable_waitStartTimeVariable 180 | DateTime 181 | false 182 | false 183 | false 184 | 185 | $Flow.CurrentDateTime 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /force-app/main/default/layouts/Dynamic_Trigger__mdt-Dynamic Trigger Layout.layout-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | false 6 | true 7 | 8 | 9 | 10 | Required 11 | MasterLabel 12 | 13 | 14 | Required 15 | DeveloperName 16 | 17 | 18 | Required 19 | Object_Type__c 20 | 21 | 22 | Required 23 | Class_Name__c 24 | 25 | 26 | Required 27 | Priority__c 28 | 29 | 30 | 31 | 32 | Edit 33 | IsProtected 34 | 35 | 36 | Required 37 | NamespacePrefix 38 | 39 | 40 | 41 | 42 | 43 | false 44 | false 45 | true 46 | 47 | 48 | 49 | Readonly 50 | CreatedById 51 | 52 | 53 | 54 | 55 | Readonly 56 | LastModifiedById 57 | 58 | 59 | 60 | 61 | 62 | false 63 | false 64 | false 65 | 66 | 67 | 68 | false 69 | false 70 | false 71 | false 72 | false 73 | 74 | -------------------------------------------------------------------------------- /force-app/main/default/layouts/Lead-Lead %28Marketing%29 Layout.layout-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | PersonalTagging 5 | PublicTagging 6 | 7 | false 8 | false 9 | true 10 | 11 | 12 | 13 | Edit 14 | OwnerId 15 | 16 | 17 | Required 18 | Name 19 | 20 | 21 | Required 22 | Company 23 | 24 | 25 | Edit 26 | Title 27 | 28 | 29 | Edit 30 | Primary__c 31 | 32 | 33 | Required 34 | Status 35 | 36 | 37 | Edit 38 | CampaignId 39 | 40 | 41 | Required 42 | LeadSource 43 | 44 | 45 | Edit 46 | First_Owner_Worked__c 47 | 48 | 49 | Edit 50 | Task_Count__c 51 | 52 | 53 | 54 | 55 | Edit 56 | Phone 57 | 58 | 59 | Edit 60 | MobilePhone 61 | 62 | 63 | Edit 64 | Fax 65 | 66 | 67 | Edit 68 | Email 69 | 70 | 71 | Edit 72 | Website 73 | 74 | 75 | Edit 76 | Rating 77 | 78 | 79 | 80 | 81 | 82 | false 83 | false 84 | true 85 | 86 | 87 | 88 | Edit 89 | Address 90 | 91 | 92 | 93 | 94 | 95 | 96 | false 97 | false 98 | true 99 | 100 | 101 | 102 | Edit 103 | AnnualRevenue 104 | 105 | 106 | Edit 107 | NumberofLocations__c 108 | 109 | 110 | Edit 111 | CurrentGenerators__c 112 | 113 | 114 | Edit 115 | SICCode__c 116 | 117 | 118 | 119 | 120 | Edit 121 | NumberOfEmployees 122 | 123 | 124 | Edit 125 | ProductInterest__c 126 | 127 | 128 | Edit 129 | Industry 130 | 131 | 132 | 133 | 134 | 135 | false 136 | false 137 | true 138 | 139 | 140 | 141 | Readonly 142 | CreatedById 143 | 144 | 145 | 146 | 147 | Readonly 148 | LastModifiedById 149 | 150 | 151 | 152 | 153 | 154 | false 155 | false 156 | true 157 | 158 | 159 | 160 | Edit 161 | Description 162 | 163 | 164 | 165 | 166 | 167 | false 168 | false 169 | false 170 | 171 | 172 | 173 | 174 | 175 | FeedItem.TextPost 176 | 177 | 178 | FeedItem.ContentPost 179 | 180 | 181 | NewTask 182 | 183 | 184 | LogACall 185 | 186 | 187 | NewCase 188 | 189 | 190 | NewNote 191 | 192 | 193 | NewEvent 194 | 195 | 196 | FeedItem.RypplePost 197 | 198 | 199 | FeedItem.LinkPost 200 | 201 | 202 | FeedItem.PollPost 203 | 204 | 205 | FeedItem.QuestionPost 206 | 207 | 208 | SendEmail 209 | 210 | 211 | 212 | 213 | 214 | Readonly 215 | CampaignId 216 | 217 | 218 | 219 | 220 | runtime_sales_social:socialPanel 221 | 222 | 223 | 224 | 225 | TASK.SUBJECT 226 | ACTIVITY.TASK 227 | TASK.DUE_DATE 228 | TASK.STATUS 229 | TASK.PRIORITY 230 | CORE.USERS.FULL_NAME 231 | RelatedActivityList 232 | 233 | 234 | TASK.SUBJECT 235 | ACTIVITY.TASK 236 | TASK.DUE_DATE 237 | CORE.USERS.FULL_NAME 238 | TASK.LAST_UPDATE 239 | RelatedHistoryList 240 | 241 | 242 | CAMPAIGN.NAME 243 | CAMPAIGN.START_DATE 244 | CAMPAIGN.CAMPAIGN_TYPE 245 | CM.STATUS 246 | CM.RESPONDED 247 | CM.LAST_UPDATE 248 | RelatedCampaignList 249 | 250 | 251 | ACTIVITY.SUBJECT 252 | EMAIL_STATUS.CREATED_DATE 253 | EMAIL_STATUS.FIRST_OPEN_DATE 254 | EMAIL_STATUS.TIMES_OPENED 255 | EMAIL_STATUS.LAST_OPEN_DATE 256 | RelatedEmailStatusList 257 | 258 | false 259 | true 260 | false 261 | false 262 | true 263 | false 264 | 265 | -------------------------------------------------------------------------------- /force-app/main/default/layouts/Lead-Lead %28Sales%29 Layout.layout-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | PersonalTagging 5 | PublicTagging 6 | 7 | false 8 | false 9 | true 10 | 11 | 12 | 13 | Edit 14 | OwnerId 15 | 16 | 17 | Required 18 | Name 19 | 20 | 21 | Required 22 | Company 23 | 24 | 25 | Edit 26 | Title 27 | 28 | 29 | Edit 30 | LeadSource 31 | 32 | 33 | Edit 34 | CampaignId 35 | 36 | 37 | Edit 38 | Industry 39 | 40 | 41 | Edit 42 | AnnualRevenue 43 | 44 | 45 | Edit 46 | First_Owner_Worked__c 47 | 48 | 49 | Edit 50 | Task_Count__c 51 | 52 | 53 | 54 | 55 | Edit 56 | Phone 57 | 58 | 59 | Edit 60 | MobilePhone 61 | 62 | 63 | Edit 64 | Fax 65 | 66 | 67 | Edit 68 | Email 69 | 70 | 71 | Edit 72 | Website 73 | 74 | 75 | Required 76 | Status 77 | 78 | 79 | Edit 80 | Rating 81 | 82 | 83 | Edit 84 | NumberOfEmployees 85 | 86 | 87 | 88 | 89 | 90 | false 91 | false 92 | true 93 | 94 | 95 | 96 | Edit 97 | Address 98 | 99 | 100 | 101 | 102 | 103 | 104 | false 105 | false 106 | true 107 | 108 | 109 | 110 | Edit 111 | ProductInterest__c 112 | 113 | 114 | Edit 115 | NumberofLocations__c 116 | 117 | 118 | 119 | 120 | Edit 121 | CurrentGenerators__c 122 | 123 | 124 | 125 | 126 | 127 | false 128 | false 129 | true 130 | 131 | 132 | 133 | Readonly 134 | CreatedById 135 | 136 | 137 | 138 | 139 | Readonly 140 | LastModifiedById 141 | 142 | 143 | 144 | 145 | 146 | false 147 | false 148 | true 149 | 150 | 151 | 152 | Edit 153 | Description 154 | 155 | 156 | 157 | 158 | 159 | false 160 | false 161 | false 162 | 163 | 164 | 165 | 166 | 167 | FeedItem.TextPost 168 | 169 | 170 | FeedItem.ContentPost 171 | 172 | 173 | NewTask 174 | 175 | 176 | LogACall 177 | 178 | 179 | NewCase 180 | 181 | 182 | NewNote 183 | 184 | 185 | NewEvent 186 | 187 | 188 | FeedItem.RypplePost 189 | 190 | 191 | FeedItem.LinkPost 192 | 193 | 194 | FeedItem.PollPost 195 | 196 | 197 | FeedItem.QuestionPost 198 | 199 | 200 | SendEmail 201 | 202 | 203 | 204 | 205 | 206 | Readonly 207 | CampaignId 208 | 209 | 210 | 211 | 212 | runtime_sales_social:socialPanel 213 | 214 | 215 | 216 | 217 | TASK.SUBJECT 218 | ACTIVITY.TASK 219 | TASK.DUE_DATE 220 | TASK.STATUS 221 | TASK.PRIORITY 222 | CORE.USERS.FULL_NAME 223 | RelatedActivityList 224 | 225 | 226 | TASK.SUBJECT 227 | ACTIVITY.TASK 228 | TASK.DUE_DATE 229 | CORE.USERS.FULL_NAME 230 | TASK.LAST_UPDATE 231 | RelatedHistoryList 232 | 233 | 234 | CAMPAIGN.NAME 235 | CAMPAIGN.START_DATE 236 | CAMPAIGN.CAMPAIGN_TYPE 237 | CM.STATUS 238 | CM.RESPONDED 239 | CM.LAST_UPDATE 240 | RelatedCampaignList 241 | 242 | 243 | ACTIVITY.SUBJECT 244 | EMAIL_STATUS.CREATED_DATE 245 | EMAIL_STATUS.FIRST_OPEN_DATE 246 | EMAIL_STATUS.TIMES_OPENED 247 | EMAIL_STATUS.LAST_OPEN_DATE 248 | RelatedEmailStatusList 249 | 250 | false 251 | true 252 | false 253 | false 254 | true 255 | false 256 | 257 | -------------------------------------------------------------------------------- /force-app/main/default/layouts/Lead-Lead %28Support%29 Layout.layout-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | PersonalTagging 5 | PublicTagging 6 | 7 | false 8 | false 9 | true 10 | 11 | 12 | 13 | Edit 14 | OwnerId 15 | 16 | 17 | Required 18 | Name 19 | 20 | 21 | Required 22 | Company 23 | 24 | 25 | Edit 26 | Title 27 | 28 | 29 | Edit 30 | LeadSource 31 | 32 | 33 | Required 34 | Status 35 | 36 | 37 | Edit 38 | First_Owner_Worked__c 39 | 40 | 41 | Edit 42 | Task_Count__c 43 | 44 | 45 | 46 | 47 | Edit 48 | Phone 49 | 50 | 51 | Edit 52 | MobilePhone 53 | 54 | 55 | Edit 56 | Fax 57 | 58 | 59 | Edit 60 | Email 61 | 62 | 63 | Edit 64 | Website 65 | 66 | 67 | 68 | 69 | 70 | false 71 | false 72 | true 73 | 74 | 75 | 76 | Edit 77 | Address 78 | 79 | 80 | 81 | 82 | 83 | 84 | false 85 | false 86 | true 87 | 88 | 89 | 90 | Edit 91 | ProductInterest__c 92 | 93 | 94 | Edit 95 | Industry 96 | 97 | 98 | Edit 99 | NumberOfEmployees 100 | 101 | 102 | 103 | 104 | Edit 105 | CurrentGenerators__c 106 | 107 | 108 | Edit 109 | AnnualRevenue 110 | 111 | 112 | 113 | 114 | 115 | false 116 | false 117 | true 118 | 119 | 120 | 121 | Readonly 122 | CreatedById 123 | 124 | 125 | 126 | 127 | Readonly 128 | LastModifiedById 129 | 130 | 131 | 132 | 133 | 134 | false 135 | false 136 | true 137 | 138 | 139 | 140 | Edit 141 | Description 142 | 143 | 144 | 145 | 146 | 147 | false 148 | false 149 | false 150 | 151 | 152 | 153 | 154 | 155 | FeedItem.TextPost 156 | 157 | 158 | FeedItem.ContentPost 159 | 160 | 161 | NewTask 162 | 163 | 164 | LogACall 165 | 166 | 167 | NewCase 168 | 169 | 170 | NewNote 171 | 172 | 173 | NewEvent 174 | 175 | 176 | FeedItem.RypplePost 177 | 178 | 179 | FeedItem.LinkPost 180 | 181 | 182 | FeedItem.PollPost 183 | 184 | 185 | FeedItem.QuestionPost 186 | 187 | 188 | SendEmail 189 | 190 | 191 | 192 | 193 | 194 | Readonly 195 | CampaignId 196 | 197 | 198 | 199 | 200 | runtime_sales_social:socialPanel 201 | 202 | 203 | 204 | 205 | TASK.SUBJECT 206 | ACTIVITY.TASK 207 | TASK.DUE_DATE 208 | TASK.STATUS 209 | TASK.PRIORITY 210 | CORE.USERS.FULL_NAME 211 | RelatedActivityList 212 | 213 | 214 | TASK.SUBJECT 215 | ACTIVITY.TASK 216 | TASK.DUE_DATE 217 | CORE.USERS.FULL_NAME 218 | TASK.LAST_UPDATE 219 | RelatedHistoryList 220 | 221 | 222 | ACTIVITY.SUBJECT 223 | EMAIL_STATUS.CREATED_DATE 224 | EMAIL_STATUS.FIRST_OPEN_DATE 225 | EMAIL_STATUS.TIMES_OPENED 226 | EMAIL_STATUS.LAST_OPEN_DATE 227 | RelatedEmailStatusList 228 | 229 | false 230 | true 231 | false 232 | false 233 | true 234 | false 235 | 236 | -------------------------------------------------------------------------------- /force-app/main/default/layouts/Lead-Lead Layout.layout-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | PersonalTagging 5 | PublicTagging 6 | 7 | false 8 | false 9 | true 10 | 11 | 12 | 13 | Edit 14 | OwnerId 15 | 16 | 17 | Required 18 | Name 19 | 20 | 21 | Required 22 | Company 23 | 24 | 25 | Edit 26 | Title 27 | 28 | 29 | Edit 30 | LeadSource 31 | 32 | 33 | Edit 34 | CampaignId 35 | 36 | 37 | Edit 38 | Industry 39 | 40 | 41 | Edit 42 | AnnualRevenue 43 | 44 | 45 | Edit 46 | First_Owner_Worked__c 47 | 48 | 49 | Edit 50 | Task_Count__c 51 | 52 | 53 | 54 | 55 | Edit 56 | Phone 57 | 58 | 59 | Edit 60 | MobilePhone 61 | 62 | 63 | Edit 64 | Fax 65 | 66 | 67 | Edit 68 | Email 69 | 70 | 71 | Edit 72 | Website 73 | 74 | 75 | Required 76 | Status 77 | 78 | 79 | Edit 80 | Rating 81 | 82 | 83 | Edit 84 | NumberOfEmployees 85 | 86 | 87 | 88 | 89 | 90 | false 91 | false 92 | true 93 | 94 | 95 | 96 | Edit 97 | Address 98 | 99 | 100 | 101 | 102 | 103 | 104 | false 105 | false 106 | true 107 | 108 | 109 | 110 | Edit 111 | ProductInterest__c 112 | 113 | 114 | Edit 115 | SICCode__c 116 | 117 | 118 | Edit 119 | NumberofLocations__c 120 | 121 | 122 | 123 | 124 | Edit 125 | CurrentGenerators__c 126 | 127 | 128 | Edit 129 | Primary__c 130 | 131 | 132 | 133 | 134 | 135 | false 136 | false 137 | true 138 | 139 | 140 | 141 | Readonly 142 | CreatedById 143 | 144 | 145 | 146 | 147 | Readonly 148 | LastModifiedById 149 | 150 | 151 | 152 | 153 | 154 | false 155 | false 156 | true 157 | 158 | 159 | 160 | Edit 161 | Description 162 | 163 | 164 | 165 | 166 | 167 | false 168 | false 169 | false 170 | 171 | 172 | 173 | 174 | 175 | FeedItem.TextPost 176 | 177 | 178 | FeedItem.ContentPost 179 | 180 | 181 | NewTask 182 | 183 | 184 | LogACall 185 | 186 | 187 | NewCase 188 | 189 | 190 | NewNote 191 | 192 | 193 | NewEvent 194 | 195 | 196 | FeedItem.RypplePost 197 | 198 | 199 | FeedItem.LinkPost 200 | 201 | 202 | FeedItem.PollPost 203 | 204 | 205 | FeedItem.QuestionPost 206 | 207 | 208 | SendEmail 209 | 210 | 211 | 212 | 213 | 214 | Readonly 215 | CampaignId 216 | 217 | 218 | 219 | 220 | runtime_sales_social:socialPanel 221 | 222 | 223 | 224 | 225 | TASK.SUBJECT 226 | ACTIVITY.TASK 227 | TASK.DUE_DATE 228 | TASK.STATUS 229 | TASK.PRIORITY 230 | CORE.USERS.FULL_NAME 231 | RelatedActivityList 232 | 233 | 234 | TASK.SUBJECT 235 | ACTIVITY.TASK 236 | TASK.DUE_DATE 237 | CORE.USERS.FULL_NAME 238 | TASK.LAST_UPDATE 239 | RelatedHistoryList 240 | 241 | 242 | CAMPAIGN.NAME 243 | CAMPAIGN.START_DATE 244 | CAMPAIGN.CAMPAIGN_TYPE 245 | CM.STATUS 246 | CM.RESPONDED 247 | CM.LAST_UPDATE 248 | RelatedCampaignList 249 | 250 | 251 | ACTIVITY.SUBJECT 252 | EMAIL_STATUS.CREATED_DATE 253 | EMAIL_STATUS.FIRST_OPEN_DATE 254 | EMAIL_STATUS.TIMES_OPENED 255 | EMAIL_STATUS.LAST_OPEN_DATE 256 | RelatedEmailStatusList 257 | 258 | false 259 | true 260 | false 261 | false 262 | true 263 | false 264 | 265 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Activity/fields/Declarative_Created__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Declarative_Created__c 4 | false 5 | Set true if activity is created declaratively 6 | false 7 | 8 | Checkbox 9 | 10 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Dynamic_Trigger__mdt/Dynamic_Trigger__mdt.object-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Specify dynamic trigger classes 4 | 5 | Dynamic Triggers 6 | Public 7 | 8 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Dynamic_Trigger__mdt/fields/Class_Name__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Class_Name__c 4 | Class name for the trigger 5 | false 6 | DeveloperControlled 7 | 8 | 64 9 | true 10 | Text 11 | false 12 | 13 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Dynamic_Trigger__mdt/fields/Object_Type__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Object_Type__c 4 | Object type for the trigger 5 | false 6 | DeveloperControlled 7 | 8 | 32 9 | true 10 | Text 11 | false 12 | 13 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Dynamic_Trigger__mdt/fields/Priority__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Priority__c 4 | 10 5 | Priority order where lower number is the highest priority 6 | false 7 | DeveloperControlled 8 | 9 | 18 10 | true 11 | 0 12 | Number 13 | false 14 | 15 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Lead/fields/Bypass_Declarative__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Bypass_Declarative__c 4 | Set or increment to bypass declarative operations 5 | false 6 | 7 | 18 8 | false 9 | 0 10 | false 11 | Number 12 | false 13 | 14 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Lead/fields/First_Owner_Worked__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | First_Owner_Worked__c 4 | SetNull 5 | First owner worked 6 | false 7 | First owner worked 8 | 9 | User 10 | Leads 11 | false 12 | false 13 | Lookup 14 | 15 | -------------------------------------------------------------------------------- /force-app/main/default/objects/Lead/fields/Task_Count__c.field-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Task_Count__c 4 | Number of tasks on the lead 5 | false 6 | 7 | 18 8 | false 9 | 0 10 | false 11 | Number 12 | false 13 | 14 | -------------------------------------------------------------------------------- /force-app/main/default/standardValueSets/LeadStatus.standardValueSet-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | false 4 | 5 | Open - Not Contacted 6 | true 7 | 8 | false 9 | 10 | 11 | Working - Contacted 12 | false 13 | 14 | false 15 | 16 | 17 | Working Harder 18 | false 19 | 20 | false 21 | 22 | 23 | Closed - Converted 24 | false 25 | 26 | true 27 | 28 | 29 | Closed - Not Converted 30 | false 31 | 32 | false 33 | 34 | 35 | -------------------------------------------------------------------------------- /force-app/main/default/triggers/leadTriggerSetFollowup.trigger: -------------------------------------------------------------------------------- 1 | trigger leadTriggerSetFollowup on Lead (after insert, after update) { 2 | 3 | // leads created as 'Working - Contacted' or with status updated to 'Working - Contacted' 4 | // have a 'Lead followup' task created. 5 | 6 | List leadsToProcess = new List(); 7 | 8 | for(Lead ld: trigger.new) 9 | { 10 | if(ld.status == 'Working - Contacted' && 11 | (trigger.isInsert || (trigger.isUpdate && trigger.oldMap.get(ld.id).status != 'Working - Contacted'))) 12 | { 13 | system.debug('leadTriggerSetFollowup: Current lead status = ' + ld.status + ' lead: ' + ld.id); 14 | if(trigger.isUpdate) system.debug('leadTriggerSetFollowup: Prior lead status = ' + trigger.oldMap.get(ld.id).status + + ' lead: ' + ld.id); 15 | leadsToProcess.add(ld); 16 | } 17 | } 18 | if(leadsToProcess.size()==0) return; 19 | 20 | List newTasks = new List(); 21 | for(Lead ld: leadsToProcess) 22 | { 23 | Task newTask = new Task(ActivityDate = Date.Today().addDays(3), 24 | Description = 'Make sure lead has been looked at', 25 | Subject = 'Lead followup', 26 | Type = 'Other', 27 | WhoID = ld.id); 28 | newTasks.add(newTask); 29 | } 30 | insert newTasks; 31 | 32 | } -------------------------------------------------------------------------------- /force-app/main/default/triggers/leadTriggerSetFollowup.trigger-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 43.0 4 | Active 5 | -------------------------------------------------------------------------------- /force-app/main/default/triggers/taskTrigger.trigger: -------------------------------------------------------------------------------- 1 | trigger taskTrigger on Task (before insert, after insert, before update, after update, before delete, after delete) { 2 | 3 | simpleLeadUpdater leadUpdater = new simpleLeadUpdater(); 4 | 5 | // What happens when you change the order of these two triggers handlers? 6 | if (trigger.operationType == TriggerOperation.AFTER_INSERT) 7 | { 8 | taskSetStatus.handleTrigger(trigger.new, leadUpdater); 9 | } 10 | 11 | if(trigger.operationType == TriggerOperation.AFTER_INSERT || 12 | trigger.operationType == TriggerOperation.AFTER_UPDATE || 13 | trigger.operationType == TriggerOperation.AFTER_DELETE) 14 | { 15 | taskTrackCount.handleTrigger(trigger.operationType, trigger.new, trigger.old, leadUpdater); 16 | } 17 | 18 | List dyanmicTriggers = TriggerExtensionSupport.getTriggerClasses('Task'); 19 | for(ITriggerExtension trig: dyanmicTriggers) 20 | { 21 | trig.HandleTrigger(trigger.operationType, trigger.new, trigger.old, 22 | trigger.newMap, trigger.oldMap); 23 | } 24 | 25 | leadUpdater.updateLeads(); 26 | 27 | } -------------------------------------------------------------------------------- /force-app/main/default/triggers/taskTrigger.trigger-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 44.0 4 | Active 5 | 6 | -------------------------------------------------------------------------------- /force-app/main/default/workflows/Lead.workflow-meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /sfdx-project.json: -------------------------------------------------------------------------------- 1 | { 2 | "packageDirectories": [ 3 | { 4 | "path": "force-app", 5 | "default": true 6 | } 7 | ], 8 | "namespace": "", 9 | "sfdcLoginUrl": "https://login.salesforce.com", 10 | "sourceApiVersion": "44.0" 11 | } 12 | --------------------------------------------------------------------------------