In this part of the blog post, we are going to use additional skills in the Process builder to model conditions which will determine auto-approvals or approvals to immediate managers.
Adding Process Controls
Process Conditions use an IF or Else rule to determine how the business process needs to be executed according to the conditions defined in the skill.
Click on the “+” icon and select Conditions from Controls.
The Conditions property will show up on the right hand side. Click on the “If” field to open up the Process Content panel to select the required field.
In this scenario, we are going to base the condition on “Hours Required”.
The condition will check if the Hours required is greater than 300 and accordingly branch the flow of execution. For now, we can keep the “EndEvent” as the target for both the branches.
Create and Configure Approval Form
For all requests which have Hours required greater than 300 hours, we need to route them to the employees’ manager for approval.
In this section, we would be creating an Approval Form. Using the “+” icon, select the option to create a new “Approval Form”.
In the popup window for “Create Form”, provide the form name and description.
This adds a new Form in the canvas. You can either use the option “Open Editor” or the menu panel to launch the Form designer.
We repeat the same process we followed when creating the Start Form. For demonstration, I have added the same fields to this form and made them as read-only. The only new field which is mandatory is “Manager Comments”. You would require managers to view the request and provide their comments before they action the request.
Save your changes and go back to the Process Builder and select the “Manager Approval” form. In the properties panel, you would need to make the below changes.
Set the Subject. This will show up in the Manager’s Inbox when a request arrives.
For the recipients, you would need to derive the manager of the employee who is raising this request. For simplicity, I am using “Process Started By” available in the metadata. This means whoever starts the request, will also get this approval request. I am using this for demonstration purposes to keep it simple and not having to deal with multiple logons.
Switch to the Inputs tab. Here, we need to map the fields from the context to the read-only field which need to show up in the Manager Approval Form. Except for “Manager Comments”, all other field can be mapped from the Process Content.
Notice the Outputs tab will have one attribute “Manager Comments” which would be used for the later.
Save all your changes. You will still see an error message for the “Manager Approval”. The Design Console will provide more information of such messages. This error message states that there are no outputs defined for this node.
Let’s define the outputs. Lets end the automation process if the manager rejects this request. Use the “+” icon to add an End event.
This should resolve the design error.
In the next blog post, I will walk through the steps to create a decision and branch the process flow based on the defined rule.