The Magic of Actions in Process Builder and Flow
The ability to use quick actions in process builder / flow has been around for a few years, but i’ve never seen a reason to use them.
I figured some out this weekend. Here are the use cases I see.
a) standardization :
if you will do the same thing (or almost the same thing) multiple times, building an action ensure standardization, and allows for easy updates if a change is needed. you can enforce required fields at the action level, even if the fields are not required at the object level. its a template / contract for creating an object. powerful stuff.
Note that this can be useful for doing the same thing on multiple nodes in a single process, or if processes on different records do the same action, say create a task or a case.
b) in process builder, quick actions can let you update unrelated records (as long as you know the record ID). so you dont need a lookup field to the record to update it!
now you may ask why that scenario would happen, so I can give you my use case.
I have a custom integration request that I am using for managing my outbound integrations (in part because I can’t wrap my head around platform events). So I create Integration request records via processes on multiple objects, for different types of integration (campaign members and opportunities at present, more to come!)
So by using a quick action to create the integration request, I can ensure the key fields are set every time.
Thats the basic idea. Then I discovered some hidden magic in actions and pb.
I use a text field on integration requests to store the id of the requesting record. It currently could be campaign member for my dotmailer (mass email) integration, or opportunity for an openexchangerate.org Integration. After the integration is complete, I want to use a process to write back to update the triggering record, because why code that part? However, as my field is a text field, not a lookup relationship, the process builder update records option does not work, as it will only allow you to update related objects.
Sure, I could create a separate lookup field on integration request for each object, but that is ugly. Or I could do this with flow, which is easy and fine. But i found a way to do it in process builder by using quick actions!
When you use a create or update action in process builder, the interface let’s you pass in ‘related record id’.
- this is only available when you select quick action - it is not available in the create record or update record option in the process builder actions dropdown. First select quick actions as your pb action, then select the specific action you are after.
- You must use a formula in pb to pass in the ID, as the ‘field reference’ option pre-filters the list of available fields for actual ID field types.
And, quick actions are not currently allowed on campaign member. So I had to go the flow route for that anyways. Bah. Apparently 5 other people feel the same way - vote and be heard!