Working With Step Dynamic Duration (Process Level)
User can set task duration using Data Source and Context Objects fields so that duration is calculated on the fly when process instance is created.
Below is example of using dynamic durations approach within process builder.
NOTE: While constructing expressions to put into "Duration" input please keep in mind that after all calculations and formatting step duration should have following format: [1d 1h 1m].
NOTE: Duration calculations are performed based on the business hours record defined in Work Relay Settings.
For more information on Work Relay Business Hours please refer to the following article Work Relay Business Hours.
Click on "Duration" field (1) to show "f(x)" link (2). Click on link to open "Edit Duration Formula" popup (3). Choose a Data Source numeric field. Apply it into Duration input for a step (4) with added time indicator (h/d/m) (5).
Given HoursPerDay__c value is 9. When the process instance is created step duration will be set to 9h.
NOTE: If time indicator was not added (e.g. final duration value was plain "{Account.HoursPerDay__c}") the system would consider duration has been provided using days. In other words if one did not add h indicator to above duration setting system would set duration to 9d once process was started.
Choose a Data Source numeric field. Select Context Object numeric field. Construct expression to put into Duration input.
Above setting will multiply HoursPerDay__c value by DaysNumber and as time indicator was not specified system will consider the result as days number. So if HoursPerDay is 8 and DaysNumber is 10 then duration will be saved as 80d once the process is started.
NOTE: For any calculations within duration input use FORMULA context in a following way: FORMULA[expression to get duration]
For more information about context objects properties please refer to following article: Working with WorkRelay Context Objects
NOTE: Within FORMULA context you can use all functions available in process builder, to get information on Work Relay functions please refer to the following article: Using Functions
Also within formula context you can use mathematical operators ( + , -, * eсt ).
User can perform complex calculations using both static and dynamic duration values within single expression using formulas, especially proper functions:
Below is an example of using these formulas:
Given one need to set duration as a sum of static and dynamic values, e.g. 5d + {Account.Minutes__c}
where Minutes__c
stores integer representing number of minutes.
Actions that needs to be performed to get it work as expected:
1. Convert static value into minutes using FROMTEXTDURATION formula: FROMTEXTDURATION(5d) + {Account.Minutes}
.
Given {Account.Minutes} is 30. Above expression will convert 5d into integer representing number of minutes (7200) and add 30, i.e. the result will be 7230.
2. Now convert 7230 into String of a format [1d 1h 1m]
using TOTEXTDURATION formula: TOTEXTDURATION(FROMTEXTDURATION(5d) + {Account.Minutes})
3. Wrap expression with FORMULA context: FORMULA[TOTEXTDURATION(FROMTEXTDURATION(5d)+ {Account.Minutes})]
Place above expression into Duration input. Once the process instance is created step duration will be set to 5d 30m.
0 Comments
Add your comment