I am using a large collection of Visual Processes (Lightning process builder) to execute APEX code, I am trying to avoid a race condition. So I am trying to figure out exactly at point does the process get triggered.

//Inserts Invoice__c
insert invoice;
insert invoiceLineItems;
//Code end

So if I have a process listening for the creation of Invoice__c, does it get triggered after the above transaction or does it get triggered at the insert process?


It comes after the workflows are executed. Check out the following link Apex Trigger order of Excution, Execute Process is #14 on the list.

In your case if you have a process flow when a invoice is created, it will be triggered before your insert the invoiceLineItems


Also consider this doc for guidance specifically on Processes

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.