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)  ## 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 ## Formula

``````iftrue([task.statecode] = 1 and [task.new_recurringtask] = 1,

SetVar ('DueDate' ,

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'))))
), 