function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LuLoLuLo 

Code Coverage/Apex Test Failure

Hi All,

I am completely lost with this code coverage message I keep on getting during my change set deployments (it's driving me crazy). Four out of the 5 error messages refer to a flow which I was able to locate via workbench but I don't know how to actually fix it. I'm not sure if turning off this specific flow during the deployments is best practice or if I should actually address this code issue -- how do I go about doing that? Any help suggestions or reference material is much appreciated. Below is a screenshot of the error message, thank you all in advance!

User-added image
Best Answer chosen by LuLo
Paul S.Paul S.
I’ve seen that error when process builder wants to create or edit a record after having some evaluation criteria be satisfied but can’t because something gets in the way. In my own case, it was because I was using a hard-coded Id (which wouldn’t exist in a test scenario) to set a lookup field value on whatever record process builder was trying to create or update. Any such scenario in our situation? As for what to do...I’m not sure I’d call it “best practice,” but you could find lots of examples of people turning off a process when deploying code for this same reason. I’d suggest that if you decide to do that, be sure you at least understand why you’re getting that error.

All Answers

Paul S.Paul S.
Was it referencing a Flow or Process Builder?
LuLoLuLo
@Paul S. It is referencing a flow which is part of a process builder. 
Paul S.Paul S.
I’ve seen that error when process builder wants to create or edit a record after having some evaluation criteria be satisfied but can’t because something gets in the way. In my own case, it was because I was using a hard-coded Id (which wouldn’t exist in a test scenario) to set a lookup field value on whatever record process builder was trying to create or update. Any such scenario in our situation? As for what to do...I’m not sure I’d call it “best practice,” but you could find lots of examples of people turning off a process when deploying code for this same reason. I’d suggest that if you decide to do that, be sure you at least understand why you’re getting that error.
This was selected as the best answer
LuLoLuLo
Thank you Paul S! Very helpful information and deactivating the Process Builder referencing that flow did the trick.