In this scenario we were asked to demonstrate how to carry out different actions depending on which field has changed on an Account record.
To do this we will use the PriorValue() function and the Case() Statement.
In this example we will update the description box of the account recording changes to the Streets in Address 1.
Note that to use the PriorValue function, the formula must be executed as Pre-Operation
N52 Formula Manager Solution
The Formula Manager solution works like this,
- A formula of type 'Save - To Current Record' is created on the Account entity
- The Source Property is set to 'Address 1: Street 1, Address 1: Street 2, Address 1: Street 3'
- The Target Property is set to 'Description'
- Scroll down to Deployment Settings , expand it and set Pipeline Stage to 'Pre-Operation (Synchronous)'
N52 Formula Manager Steps
The following set of steps outline how to create this Formula
- Create a new formula of type 'Save - To Current Record'
- Set the Source Entity to 'Account'
- Set the Mode to 'Server Side'
- Copy and paste the formula below into the formula
- Click save and test
Case( true, When(PriorValue('[account.address1_line1]') != [account.address1_line1]), Then ('The field address1_line1 has been modified'), When(PriorValue('[account.address1_line2]') != [account.address1_line2]), Then ('The field address1_line2 has been modified'), When(PriorValue('[account.address1_line3]') != [account.address1_line3]), Then ('The field address1_line3 has been modified'), Default('NoOp') )
Did you know?
Quality Dynamics 365 Projects are Delivered Faster with TestShield
Deliver fully tested Dynamics processes earlier and at less cost. Product owners, testers and developers collaborate easily, delivering fully tested systems in short sprints.
- Accurately capture test data in visually in Excel like sheets
- Create perfect automated tests with data and execute on a schedule or within your Azure DevOps pipelines
- Quickly update easy-to-use spreadsheets to maintain tests