0

For example, I know I can use Trigger.Old in an update trigger to access the old version of a record (before the update takes place). Is this possible in Process Builder or Flow Builder?

I've written a bunch of Apex code to handle business logic, and some of this logic requires a comparison of field values between the old version and a new version of an updated record. I know using the declarative tools when possible is best practice, and I'm considering using them instead of all this Apex code, but I can't find any information saying whether or not I can access the old (pre-update) version of records in Process Builder or Flow.

1

Although it is possible to use Is changed in the process builder to see if the record or field was changed, if you want to get the old record, like you would in a trigger context, I recommend using a variable in your flow to pass the old values as needed.

For example, if you need the opportunity's picklist field StageName in a flow, because you have multiple steps and you want to do different logic based on the previous step, you can adjust your flow to receive the old value as a variable using a formula on the field, like PRIORVALUE(StageName).

This way, if your flow has a record input, you'd also have a string input for that old value.


Now, as for what "best practices" say, that will depend on your solution. Is this logic big or does it take a good amount of time to process? If so, then you might face issues when processing lots of records at once. If that happens, moving the logic to Apex would be the best practice, I think.

  • Excellent - thanks for your help. – Elsewhere May 19 at 13:03
0

If you are just checking that the value changed, you can simply select an Operator of IsChanged filter and a Value of True.

Process Builder Is Changed Filter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.