/
Process Builder Errors and Weirdness

Process Builder Errors and Weirdness

Oh those dreaded process builder errors. They are sooooo annoying. You spend so much time and effort building a great solution for your users and all that good work is undone with a badly worded error message. What can the user even do about this - there is nothing they can do except undo what they were trying to do and get frustrated and annoyed. 

(screen shot taken in Summer '16 version of Salesforce - with the horrible vertical nav). 

(screen shot with classic). 

 

This post puts it well http://www.ezrakenigsberg.com/blog/makingsenseofprocessbuildererrormessages and gives us an idea of how we can find which Flow (ah, Process) is causing the error. 

in the email the error is a liltle more informative. 

An error occurred at element myRule_1_A1 (FlowRecordUpdate).
The flow failed to access the value for myVariable_current.Campaign.Description because it hasn't been set or assigned.

So at least, once we know what process it is that caused this error, we can see that it has something to do with Campaign or Description. 

TL:DR

Just use this in your criteria

(This article gives a bit more info on this option https://salesforcesidekick.com/2016/07/11/how-to-work-with-related-records-in-process-builder-criteria/

 

Or this in your update

To get around this horrible horrible error. Now read on for the full details. 

Why this Post

I really don't know why the examples in this post worked 90% of the time. Prior to this I had just about rage quit process builder. I had tried everything possible, or so I thought. I had even re-made processes into flows just to get around this error (as per the example below). Maybe it was because my real world attempts were based on multiple fields that obfuscated what the actual problem is. Maybe by simplifying the process (as per the rules of debugging), that's why I could get it to work more often. I dunno. But next time I do a more complex PB and come a cropper I will update this post.

 

Making this Error

It was so simple to create a process that gave an error like this. This would be something that you would do in workflow in a snap. All I tried to do was to set the Opportunity Description to be the Description from the Campaign - now, you would probably not do this in real life, but I knew this would create this hasn't been set or assigned error. 

So this process runs on the Opp Object and runs whenever the record is created or edited - with no additional criteria and tries to set the Description field to the description from the related Campaign. 

The opportunity record I edited had no Campaign, so there was no description to be found, so it errored. Workflow would just put blank in there - as it should. WHY OH WHY does this cause an error in Process Builder? As soon as I add a Campaign to the Opp, this error disappears and it happily updates the description field. 

I recreated the exact same process in a flow and it did not have an error at all. It even degraded nicely and deleted the value in description when I removed the Campaign from the Opp. 

The flow takes in the param of the Opp ID, looks up the Opp to find the Campaign ID, then looks up the Campaign to find the Description, then updates the Opp with the Campaign Description. Easy. 

So I created the same thing in a Workflow (this example can be done in a workflow. Again, no error and it behaves very nicely by adding or removing the description based on if there is a Campaign on the opp or not. 

 

So, Flow works, Workflow works, but for the simplest of simplest updates, Process Builder shows such an ugly error that it makes you never ever want to use Process Builder again. Your users do not deserve this crappy experience using Salesforce. 

Researching this Error

So of course, the first thing you do is copy and paste the error message into Google hoping to quickly find the solution.

The first post you come across is a Salesforce KB article. 

https://help.salesforce.com/apex/HTViewSolution?id=000212174&language=en_US

It says "use criteria to check if the foreign key (aka relationship) field is null before making cross-object references based on that field". Let's try that.