Views:

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)  


North52 Decision Suite Solution

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

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

Formula

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.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'))))
       ), 
     
     UpdateRecord('task',
       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?

You can easily add powerful business logic to Power Apps Portals

North52 Business Process Activities provides the ability to easily configure and execute business rules on Power Apps Portals Forms.

We make it very easy for you to configure simple or complex logic that changes the behavior of the form:

  • Show/hide fields
  • Show/hide sections
  • Set fields required/not required
  • Show/hide notifications
  • Set field values
Learn more about North52 BPA for Dynamics Portals