I had a requirement to check for 8 different factors that could require an object to be sent for approval in an approval process. Also the approver needed to be told about all the factors that applied and approve or reject them in one go. This requirement does not fit to easily into the available approval process mechanisms. (If I’m wrong and there is a cleaner way to do this please comment.)
Here is the pattern that allows this behavior:
- Add a text area custom field to the object called something like “ApprovalRequiredReasons”.
- Put all the approval logic – in my case 8 checks on fields of the object and fields of parent objects – in an “Initial Submission Action” of type “Field Update” that updates the “ApprovalRequiredReasons” field. The formula builds a new-line separated text string explaining the factors that apply. Here is an example of the style of formula to use:
IF(booleanExpression1, 'Factor 1 explanation' + BR(), '') + IF(booleanExpression2, 'Factor 2 explanation' + BR(), '') + IF(booleanExpression3, 'Factor 3 explanation' + BR(), '') + ...
- Then the approval steps just reference the “ApprovalRequiredReasons” field and so avoid duplicating any of the logic. In the simplest case they can just check whether the string has a length greater than zero or not. But in my case a two step approval was sometimes required and I could achieve this by matching to two specific values in the string in two approval steps.