+ Start a Discussion
Sri549Sri549 

Test Class getting Failed because of Process Builder

Hi Folks,

I am getting this exception when try running test class.

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “Lead Process” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to create records: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY: insufficient access rights on cross-reference id: 7014V000001yxjM. You can look up ExceptionCode values in the SOAP API Developer Guide.eference id: 7014V000001yxjM. You can look up ExceptionCode values in the SOAP API Developer Guide.: []

When Deactivating Process Builder, I am able to run successfully.
I am providing valid data based on process builder crtieria as well.

No clue , who do i solve this.

Appreciate, your help!

Thanks!
Srinivas
 
AbhinavAbhinav (Salesforce Developers) 
Hi Srinivas,

Check below thread Some one posted an answer which worked for them.Try this suggestion.

"You might get this error if the SObject (that you're inserting in Test class) has an active Process Builder that expects certain fields to have values and those field values are NOT supplied in the test data before inserting them.

Try to pack all the necessary fields for the SObject that are required by process builder. You don't need to deactivate the process builder to run test successfully.

If you have record types set for that SObject make sure you supply the appropriate record type in the test data preperation as well."

https://developer.salesforce.com/forums/?id=906F0000000Aw7DIAS

If it helps mark it as best answer.
Thanks!