Views:

Scenario Overview

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. 

North52 Decision Suite Solution

The North52 Decision Suite 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.


North52 Decision Suite 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

Formula

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?

You can easily schedule recurring processes or CRM record updates

Every business has recurring processes and tasks that need to be done on repeatable and scheduled basis. Microsoft Dynamics 365 users are often surprised to learn that it is difficult to achieve using standard functionality. The North52 Scheduler makes it easy to trigger workflows and/or advanced business logic for specific entity records on a scheduled basis. 

Key features include:    

  • Create Recurring Schedules within Dynamics CRM
  • Powerful Record Targeting - easily create queries to target a specific set of records
  • High Performance - can process 100,000+ records on a scheduled basis
  • Execute Workflow/Action or Update Entities
  • Native to Dynamics 365

Learn more about the Scheduler