Flow Triggers - Defaults and Value Changes
Before-Save Flow Triggers are a quite different way of thinking than Process Builders which run in the After Save context. You will use far-fewer IsChanged scenarios, you will use Formulas more.
I’m trying to make rules for my scenarios so here’s an attempt
ALWAYS Set the Value
Before-Create
Before-Update
Example - Manager Name
For when the value ALWAYS has to be the latest updated value
Eg if the Manager Name changes, the next time the record is updated it will display the correct Manager Name
Also handles if the Manager is not set
Formula fManagerName
Assign to Manager Name field
IF(NOT(ISBLANK({!$Record.Manager__c})),{!$Record.Manager__r.FirstName} & " " & {!$Record.Manager__r.LastName} ,"")
Issues
Will this set if the Manager is set by Default?
Example - ID
For when there is an ID on a related record and it needs to be on this record.
This is due to maxing out my spanning limits so I can’t do formulas.
Checks if the Schedule lookup field has been set
Formula fScheduleID
Assign to ScheduleID field
IF(NOT(ISBLANK({!$Record.Schedule__c})),
{!$Record.Schedule__r.ID__c},null)
Set Default Value
Before-Create
Before-Update
If the user already enters the value you need to keep that
Otherwise set the default based on the related record.
Formula fManager
Assign to Manager field
IF(NOT(ISBLANK({!$Record.Manager__c})),{!$Record.Manager__c},{!$Record.Account__r.Manager__c})
Do Not Change if Active
Before-Create (if a record can be created as Active)
Before-Update
Formula fClient
Assign to Client Field
Only Change if Updated
Before-Update
Eg I have a picklist that is a Preset… depending on that Preset it sets a number of other values. However the user can set the Preset, THEN override the other values manually.
create variable varAutomaticOption
set default value on varAutomaticOption to {!$Record.AutomaticOption__c}
Create a Decision Element
Outcome Name SettingA
{!$Record.Preset__c} = “Setting A”
AND
{!$Record__Prior.Preset__c} Not Equal To {!$Record.Preset__c}
Create an Assignment after the Outcome for SettingA
Assign {!varAutomaticOption} to “Automatic” (the default for that preset).
In the final Assignment
Assign {!$Record.AutomaticOption__c} field {!varAutomaticOption}
That way the varAutomaticOption will be the current value unless the preset is changed, then it will be set to the new value and the AutomaticOption will be saved.
Note my Presets set 8 fields in this way, so I’m not sure I would do it this way if it was just one field.