Hot answers tagged

2

If anyone needs this in the future, here's the code: Trigger Trigger OppContactRoleTrigger on OpportunityContactRole (after insert, after update){ AddPrimaryContactToOpportunity.runFlow(); } Class public class AddPrimaryContactToOpportunity { public static void runFlow() { for(OpportunityContactRole ocr : (List<OpportunityContactRole>) ...


1

You didn't set the cctOpp1.NumberOfEmployees field to a value over 99 so it would never enter your loop in the test class to create multiple accounts nor would it enter your logic in the trigger to create Opportunities as you have the same condition set (> 99). @IsTest public class TenIdenticalOpportunity { public static void createOpportunity() ...


1

Realised my problem! The assignment needs to be the other way around. Instead of : en.hed__End_Date__c = enn.Graduation_Date__c; It should be: en.Graduation_Date__c = enn.hed__End_Date__c; Thanks!


1

So the issue I see here is that calling a flow is not a bulkified process, but to get you a little further, here is you code reworked: public class AddPrimaryContactToOpportunity { public static void runFlow() { //I admit, this is not bulkified for(OpportunityContactRole ocr : Trigger.new) { Flow.Interview flow = ...


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