In this scenario we have the need that whenever the description field changes on a Case record we have to update this new description text to a custom field call workscope on the email entity for all related sent emails. The tricky part here is that we need to re-open the email so we can set the workscope field.
This sample demonstrates how to execute multiple statements within a ForEachRecord() function call.
N52 Formula Manager Solution
The Formula Manager solution works like this,
- A formula is created which executes on the Update of the Description field on the Case entity
- The formula first finds all related emails which have been marked as sent
- Then for each email it performs 3 actions
- Action 1: Set the email back to draft
- Action 2: Update the workscope field with the description field from the Case
- Action 3: Set the email back to it original status of sent.
N52 Formula Manager Steps
- Create a new formula of type 'Save - Perform Action'
- Set the Event to 'Update'
- Set the Source Entity to 'Case'
- Set the Source Property to 'Description'
- Copy & paste the formula below into the formula description field & click save
- You are now ready to test
ForEachRecord( FindRecords('email', SetFindAnd('regardingobjectid', 'statuscode'), SetFindAnd([incident.incidentid], '3') , 'activityid'), UpdateRecord('email', CurrentRecord('activityid'), SetAttributeStatus(0,1)), UpdateRecord('email', CurrentRecord('activityid'), SetAttribute('new_workscope', [incident.description] )), UpdateRecord('email', CurrentRecord('activityid'), SetAttributeStatus(1,3)) )
Did you know?
North52 Decision Suite works with vanilla Common Data Service instances
The North52 Decision Suite works with Common Data Service instances which have not had any Microsoft 1st Party apps applied (Field Service, Customer Service, Sales Enterprise, etc). This means you can use our no-code advance business rules engine in your custom Model Driven and Canvas Power Apps!
It is the same solution which has been powering Microsoft Dynamics 365 CR/CE for many years. You get a mature, robust solution with proven capabilities (over 500 functions) that allows you to build complex decision logic for use in your custom apps.