@ZacharyJeans is a Twitter machine (nearly 100K posts!). So it’s good to see him roll up his sleeves and have a crack at Salesforce’s Trailhead learning challenges.
It can be hard work to get started, but social media can provide a lot of moral and practical support!
The actual problem that Zachary had to solve for his Trailhead challenge was the opposite of what I explained here. In this example we have a contact which will refresh it’s address information from the parent account every time it is updated. The Trailhead challenge called to update all child Contacts whenever the account was updated. Good job I didn’t do his homework for him!
Here is the walk through which I wrote at the time. I found it very interesting to see where someone new to Process Builder started with the tool. Hopefully these pointers helped, I think they did as he tweeted later showing some of his new Trialhead badges!
Create New Process
Create the process and set it to fire on create & update of a Contact record. Remember though that in a nice clean Salesforce environment, when the new Contact is displayed it defaults the address fields from the owning Account. So this is more a scenario for updates.
Depending on the scenario, you can set the filter conditions as needed. Here I am working with just the street and postal code. Thanks to the new feature in Process Builder, we can “OR” these conditions.
In a real situation my preference here would be to have a formula field checkbox outside of the process which I would used to model the criteria. I’d call the field something like “Update Contact Address Required”. But for now, let’s use the standard fields on the object.
Define The Update Action
With the criteria set, the branch to the action will be followed whenever they are true.
We need an action to “Update Records”, where the record will be the Contact record we are working with. This can be slightly confusing when new to Process Builder, the trick is to click the name of the object and not get distracted by the list of the other fields:
Set Object Variables
Then set the Contact fields to come from the related Account fields.
Set each field, I have just updated the street and postal code.
Save, Activate, TEST TEST TEST!
You are going to feel so great when this runs and works first time!
Here’s my Account.
Here’s my new Contact with the street and postal code copied in by the process!
If it doesn’t work first time, then retrace your steps. If it does run, don’t just go and have a coffee to celebrate, TEST SOME MORE!
Why? Because there is a gotcha in here which will cause an error… can you find the cause?
After all, this is a computer program!
Good luck & enjoy the process…
….update. The gotcha is that updating a contact which has no Account will cause an error.
The solution is to add an extra condition into the process filter to make sure that the update is only fired when an Account is listed for the current Contact.