Process Builder – Breaking Production Deployments?

I have a Process Builder flow set up and I am running some tests around the InvocableMethod Apex code. The tests pass fine in my staging and production environments. Yet, when I try to deploy to production, I get a strange error.

CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow.

Thankfully I received a somewhat more informative error email.

UPSERT FAILED — ERRORS : (CANNOT_EXECUTE_FLOW_TRIGGER) The record couldn’t be saved because it failed to trigger a flow.
common.exception.AssertionException: ORA-20070: Cannot read from apex_class and apex_trigger while running tests — for SFDC record with ID : null,

Unfortunately, the deployment has nothing to do with the flow and it is unclear why it is failing. What is the root cause of this error and how can I fix it?

EDIT:

I found out this is a known issue. The other claimed workaround is to deploy via the Metadata API.

UPDATE:

Because I was subscribed to the Known Issue, I received the following confirmation this issue is resolved.

We are pleased to notify you that the following Known Issue has been resolved: Executing an InvocableMethod during an apex test run from a change set can cause Errors.

Thank you for being patient while we worked to address this issue. Please feel free to reach out to Customer Support if you have further questions.

Sincerely,

Salesforce Success Team

Answer

I remember reading a post about this being a bug on the Salesforce side. I think the workaround was to deactivate any other Processes that might trigger on other objects during record creation in the test class.

Attribution
Source : Link , Question Author : Adrian Larson , Answer Author : cricketlang

Leave a Comment