Scenario Overview

In this scenario we wish to automatically create follow up tasks whenever a task is completed. We will need to be able to dictate how far into the future the follow up task should be and the follow up task can only be due to be completed on working days. 

Note: For this formula you will need to create and add 3 custom fields on the Task entity and form  - new_original_scheduledend  (of type Date time), new_recurringtype (of type Boolean) and new_recurringtask (of type Option Set as shown below - you may need to match these up to the formula if your Option Set differs)  

N52 Formula Manager Solution

The Formula Manager solution works like this:

  • We create a formula to trigger whenever a Task is set to complete
  • Once the formula has been triggered, it will check to make sure the Task is a recurring task
  • If it is, the formula will calculate the Due Date of the follow up Task using the Original Scheduled Date and the Recurring Type selected on the form
  • The formula will then check to see if this Due Date is a working date and it will move the Due Date onto a working day if needed

N52 Formula Manager Steps

Formula Steps

  • Create a new formula of type 'Save - Perform Action'
  • Set the Event to 'Update'
  • Set the Source Entity to 'Task'
  • Set the Source Property to 'Activity Status'
  • Copy and paste the formula description below into the Formula Editor canvas
  • Click Save 


iftrue([task.statecode] = 1 and [task.new_recurringtask] = 1, 
     SetVar ('taskID' , Clone ('task', [task.activityid],'false')),
   SetVar('OriginalScheduledEnd' , if( ContainsData ([task.new_original_scheduledend]), 
                                      [task.scheduledend] )) , 
   SetVar ('DueDate' , 
       Case([task.new_recurringtype]  ,
          When ( '100000000' ) , then (AddDays (GetVar ( 'OriginalScheduledEnd') , 7 ) ) , 
                      /* this may differ in your picklist , please match up number to values wanted*/
          When ( '100000001' ) , then (AddMonths (GetVar ( 'OriginalScheduledEnd') , 1 ) ) ,          
          When ( '100000002' ) , then (AddMonths (GetVar ( 'OriginalScheduledEnd') , 3 ) ) ,     
          When ( '100000003' ) , then (AddYears (GetVar ( 'OriginalScheduledEnd') , 1) ) ,    
          When ( '100000004' ) , then (AddMonths (GetVar ( 'OriginalScheduledEnd') , 6 ) ) , 
          Default ('NoOp') 

    ) , 
     SetVar ('MasterRecurring', GetVar ('DueDate') ) , 
     iftrue (IsWorkingDay (LocalTimeFromUtcTime(GetVar('DueDate'))) = false, 
           LoopUntilTrue ( 
                SetVar ('DueDate' , AddDays (GetVar ('DueDate') , 1 ) ) , 
              IsWorkingDay (LocalTimeFromUtcTime(GetVar('DueDate'))))
       GetVar ('taskID' ) , 
       SetAttribute('scheduledend' , GetVar('DueDate')), 
       SetAttribute('new_original_scheduledend', GetVar('MasterRecurring'))

Wizard - Clone

Please see below the wizard you can use to create the Clone() function call used in this formula. 

Note you don't need to enter anything for the Child Records. 

Did you know?

North52 helps Government (federal and state) departments with complex rules in their Dynamics 365 systems

Public sector organizations frequently deal with large user bases and complex rules and routings. The North52 Decision Suite helps government orgnizations with Dynamics 365 manage processes like:

  • Case Management - task checklists, routing, prioritization and approval
  • Eligibility checks for applications/enrollment
  • Licensing administration

Learn more about the North52 Decision Suite