+ Start a Discussion
Eric BlaxtonEric Blaxton 

Process builder and Trigger firing out of sequence

Hi and thanks for your help in advance.

I am having what appears to be an Order of Sequence violation.
  1. This error happens intermittently and never happens when testing.  Based on the Order of Execution it shouldn’t be happening.
Here is what I have
  1. User enters a Registration Request
  2. Enters in required fields
  3. Hits save
  4. Before insert trigger which checks for duplicate records
    1. If duplicate found there should be an error message thrown.  (happens frequently)
  5. Process builder which:  (here is where I sometimes get the “Field Custom Validation Exception”)
    1. Looks for logged in user
    2. Looks for Account Team member of logged in user
    3. Assigns team member to variable x
    4. Writes x to Registration Request Record
  6. Saves original  record
  7. Creates another record
Of course, If we had better error messages for Process builder, this would be a moot question.  
Paul S.Paul S.
Do you have any validation rules on the Registration Request record?  Is it trying to utilize an account team member whose user account is inactive?
Eric BlaxtonEric Blaxton
Hi Paul,

Thanks for the suggestion.  That was one of the first thing I checked hoping for something obvious, but all users are active.  The error fires inconsistently.  There are times when I will get the pretty Custom error field stating there is a duplicate and what to do next.  Other times, I get the ugly "Field Custom Validation Exception" with no clue for the users on what to do next.  I now the error is being caused by a duplicate record.

It's acting like the Process is running before the "Before" Trigger.
Paul S.Paul S.
In step 7, what is creating the next record? Process builder? The user? Something else?