Skip to main content
10 events
when toggle format what by license comment
Jun 1, 2018 at 15:35 vote accept AstroLovesCodey
May 31, 2018 at 0:54 comment added Daniel Ballinger Yes, exactly like that. It is a better approach in the long term, but more complicated up front. For instance, you would need to change IsHandlerDisabled from a static to and instance method so that it could be mocked.
May 31, 2018 at 0:46 answer added Daniel Ballinger timeline score: 4
May 31, 2018 at 0:41 comment added AstroLovesCodey So, something like this: developer.salesforce.com/docs/atlas.en-us.apexcode.meta/… ??? I'm sorry, I'm not really experienced with stubs. Also, I still would like to know what's going on with the metadata call if you (or anyone) have time to look at it.
May 31, 2018 at 0:30 comment added Daniel Ballinger If possible edit it into the original question. It will make it easier for others to follow. I'm thinking you can use a Stub to control the results of AccountTriggerCheckDisabled.IsHandlerDisabled(..) from the test class. That way it doesn't matter what the CMDT is actually set to.
May 31, 2018 at 0:28 comment added AstroLovesCodey Sorry for formatting. Neither ctrl-k nor indenting 4 spaces helped it.
May 31, 2018 at 0:28 history edited Daniel Ballinger CC BY-SA 4.0
Merged in Trigger from comment.
May 31, 2018 at 0:26 comment added AstroLovesCodey Here's an example of one: trigger AccountTrigger on Account (after update) { String customMetadataField = 'Disable_Account_c_AU__c'; Schema.SObjectType accountType = Schema.Account.sObjectType; accountType = Account.sObjectType; Boolean enableHandler = AccountTriggerCheckDisabled.IsHandlerDisabled(accountType, customMetadataField); if(enableHandler){ new AccountTriggerHandler().run(); } }
May 31, 2018 at 0:21 comment added Daniel Ballinger What does the trigger itself look like? In particular, show how it interacts with the Custom Metadata Type.
May 30, 2018 at 23:11 history asked AstroLovesCodey CC BY-SA 4.0