Excited

A very much awaited feature is coming in Summertime '21 – we will accept the ability to utilise the IsNew(), IsChanged() and PriorValue() syntax in formulas equally you can in workflow rules and processes in record-triggered and scheduled flows.

Hither are a few lessons learned from implementing this utilise case:

  • Use the IsNew(), IsChanged() and PriorValue() syntax in flow formulas

Business concern Use Instance: Addison Dogster is the system administrator at Universal Containers. She has been tasked with creating automation for case management that requires determining when a record is new, a field is changed and the prior value was a certain value.

Solution: In Winter '21 release orgs, Addison would take to create the solution using a process (older automation feature). With Summer '21, she is able to create this automation in flow (cease state declarative automation tool). Yep!

The automation solution (in this case, a record-trigger menstruum) looks like this:

FormulaExampleFlow

(1) Nosotros have this record-triggered flow beginning when a new example record is created or a instance tape is updated before the record is saved. (2) We determine whether the example record is (a) new or the status is working or (b) the status is inverse and the status was previously working. (3) Lastly, updates are fabricated to the example record.

Highlighted Steps:

Note: This menstruum is an example that shows the use of the IsNew(), IsChanged() and PriorValue() formula syntax in flow formulas. This is not meant to be a fully documented solution.

1. Create the record-triggered flow shown in a higher place. In Lightning Experience, it is establish under Process Automation | Flows . Click on " New Flow ." Select Record-Triggered Flow . For those using Salesforce Classic, flow can exist institute in Create | Workflows & Approvals | Flows . Select the Tape-Triggered  Flow and click the Create button.

In the flow, we would configure the following menstruation resources.

A. We demand to create a formula  resource called NeworWorkingCaseFormula to determine whether the example record is new and the status is "New" or the case tape is changed and the condition is "Working." If this evaluates to true, then the resource is set to true.

Best exercise tip: Provide a description so you and other/future admins know what this menses resource is used for.

This is how that flow resource would be configured.

  • Resource Blazon: Formula
  • API Name: NewOrWorkingCaseFormula
  • Data Type: Boolean
  • Formula: (ISNEW() && TEXT({!$Record.Status}) = "New") ||
    (ISCHANGED({!$Record.Status}) && TEXT({!$Tape.Status}) = "Working")

NeworWorkingCaseFormula

B. We need to create a formula resource called PriorValueNeworWorkingCriteriaFormula to make up one's mind whether the instance record is inverse and the status' prior value is "New" or "Working." If this evaluates to true, then the resources is set to true.

Best practice tip: Provide a description and then y'all and other/future admins know what this flow resources is used for.

This is how that flow resources would exist configured.

  • Resource Type: Formula
  • API Proper name: PriorValueNeworWorkingCriteriaFormula
  • Data Type: Boolean
  • Formula: ISCHANGED({!$Record.Status}) &&
    (TEXT(PRIORVALUE({!$Record.Condition})) = "New" || TEXT(PRIORVALUE({!$Record.Status})) = "Working" )

PriorValueNeworWorkingCriteriaFormula

C. Starting time, configure the showtime element every bit follows.

  • Trigger: A tape is created or updated
  • Run Flow: Before the record is saved
  • Object: Case (no conditions are configured)

FormulaExampleFlow-Start

D. Create a Decision flow element that determines which path to take: (a) NeworWorkingCase-Criteria or (b) PriorValue.

Best practice tip: Provide a clarification and so you and other/future admins know what this menstruum resource is used for.

Configure every bit follows:

  • Upshot: NewOrWorkingCase-Criteria
    • {!NeworWorkingCaseFormula} Equals {!$GlobalConstant.Truthful}
    • When to Execute Outcome: If the condition requirements are met
  • Event: PriorValue:
    • {!PriorValueNewOrWorkingCriteriaFormula} Equals {!$GlobalConstant.True}
    • When to Execute Consequence: If the condition requirements are met

FormulaExampleFlow-Decision

East. Create an Assignment chemical element for each consequence to update the field values according to your use case.

F. Debug the flow to ensure it is working as expected.

G.Relieve and actuate your flow.

Best practice tip: Provide a description so you and other/future admins know what this flow is for.