A new knowledge base article has been published on our support portal.
Scenario Overview
In this scenario we needed to implement a business rule that will calculate the number of days between two dates on the Opportunity entity. The result of this calculation to be place into a field called Days Open on the Opportunity entity.
A schedule will also be created to execute each night which will keep this field continuously updated.
N52 Formula Manager Solution
The Formula Manager solution works like this,
- Use the DateDiff() function
- The first parameter defines the startdate, which in this example is a field on the Opportunity entity
- The second parameter is the enddate, which uses the UtcDateTime() to return the current date & time
- The third parameter defines the time interval to return, in this case seconds. This allows us to accurately calculate (2 decimal places) the the number of days between the 2 dates
- We divide the result by 86400 (seconds in a day) to get out final result
- This result is then used to update the field ‘new_days‘ field on the Opportunity entity
- Now we can create a workflow to call this Process Genie
- The workflow will execute the Process Genie
- Finally a North52 Schedule will be used to find all open opportunities & execute the workflow above for each Opportunity record.