In this scenario we require a max character limit of 25 characters for the Account fields Street 1, Street 2 and Street 3. Any characters over this limit will be truncated. We want this rule to be applied to data BEFORE it is committed to the database and no matter where it comes from - e.g. from an import, SDK call, standard input form. The SetEntityTargetRecord function allow us to do this.
N52 Formula Manager Solution
The Formula Manager solution works like this:
- A formula of type Save- Perform Action is created that triggers on creation or updating of Account fields: Address 1: Street 1 , Address 1: Street 2 and Address 1: Street 3
- The formula ignores any characters after the 25th character
- The formula does this at the Pre-Operation stage so that the fields are validated before they are saved into the database
N52 Formula Manager Steps
- Create a new formula of type 'Save- Perform Action'
- Set the Event to 'Create and Update'
- Set the Source Entity to 'Account'
- For Source Property Ctrl-click 'Address 1: Street 1, Address 1: Street 2 and Address 1: Street 3'
- Scroll down to Deployment Settings and for the Pipeline Stage select 'Pre-Operation'
- In the Formula Editor, paste in the Formula provided below
- Click Save
- The formula is now ready for testing
SetEntityTargetRecord( SetAttribute('address1_line1', left([account.address1_line1], 25) ), SetAttribute('address1_line2', left([account.address1_line2], 25) ), SetAttribute('address1_line3', left([account.address1_line3], 25) ) )
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