Using Power of One in Process Builder?
Really? How do they relate?
Well, let me tell you.
There are often times when you need to be creative with how you get things done in Salesforce, because, well, you’re often trying to fit square pegs into holes of shapes that defy words. When you do, wouldn’t it be great to have a truism in every record? Call it an anchor to reality you can always rely on.
Yes, it’s 1.
I have a process that runs on the Contact record. Since it’s my only Contact process, it includes a bunch of logic branches, each of which I’d like to completely address all aspects of that circumstance to keep things orderly.
As you can see from the excerpt above, the branch has a bunch of actions, some include their own conditional logic, notably the third one.
Let’s dive into the logic.
- Branch (Diamond) Logic
(ISNEW() && !isblank(text([Contact].GROW_CT_Status__c))) || ISCHANGED( [Contact].GROW_CT_Status__c )
Based on this logic, if the record is new and the field has been populated, or the field changed, the three actions will be performed.
- Though not shown, Action 2 is a timestamp that happens whenever the branch evaluates to true.
- Action 3 uses simple conditional logic to it only execute if the pick list is set to “Active/Approved”
- Action 4 is where things get interesting. We only want to only run the action if the pick list was changed from Active/Approved to anything else.If it were a Workflow Rule, you could compare the current and prior values like follows:
TEXT( GROW_CT_Status__c ) != 'Active/Approved' && TEXT( PRIORVALUE( GROW_CT_Status__c )) = 'Active/Approved’
In the context of Process Builder, you essentially want to say
IF ( TEXT([Contact].GROW_CT_Status__c ) != 'Active/Approved' && TEXT( PRIORVALUE([Contact].GROW_CT_Status__c )) = 'Active/Approved', TRUE, FALSE)
Since you’re limited to how you can use logic in this part of the Process Builder, you need a truism or anchor point to rely on.
Enter the Power of One!
Above Contacts is the name of our Power of One field. We’re using the formula option to analyze whatever is needed then make the action happen, or not, based on whether the result equals the Contacts field, which is always 1. Our anchor!
Looking at this example, the IF statement will:
- If the field does not currently equal ‘Active/Approved’ but it did just before the record update, the IF returns 1. Since 1 = Contacts (Power of One), it’s true and the action will happen.
- Otherwise, the IF returns 0. Since 0 ≠ Contacts, the action will not happen.
A purist would say it’s a side benefit of the Power of One, rather than using it. Maybe, but it’s yet another way that one field containing the value 1, can make your life a ton easier.
If you’re not familiar with the Power of One, here’s the famous Steve Molis presenting it at Dreamforce.