Hot answers tagged

4

You could do this using a Process Builder (the downside is this uses more CPU so you could later hit CPU limit issues if you have a lot of other processing going on when contacts are updated). If you stick with this trigger-based approach note that you are doing far more iteration than needed and there's no need to query the account instances. I recommend ...


2

The first idea that came to me, is to add a technical field on account (flag, default = false). Extend your CSV with the new flag, set for all = true Update accounts Extract contacts with condition where Account.MyFlag__c = true update contacts Delete flag (since not more useful)


1

A good pattern to follow when writing a testmethod is the Given-When-Then pattern // Given a mock Account // When Account Updated // Then Verify Contact created then fill in the details // Given a mock Account Account mockAccount = new Account(...); insert mockAccount // When Account Updated Test.startTest(); update mockAccount; Test.stopTest(); // ...


Only top voted, non community-wiki answers of a minimum length are eligible