6. Add the Approve Document Task Step
In this step, you will add a Task step for the document approval decision. The Task step recipient (or person assigned the task) comes from the Approvers column you created in the SharePoint library. When you submit the document approval form for the first time, you will select one or more users to assign this task to. There are two decision actions to choose from: Approved or Rejected. You will configure outcome rules so that all approvers must approve the document or the workflow follows the rejected outcome.
-
Add a Task step to the workflow with the following configuration:
- Instructions: Please review the attached document and indicate your approval decision.
- Actions: Approved, Rejected
- Form: SmartForm > Display Document
- References: Keep default settings
- Open Task: Help me configure it
- Workflow View: Create a new State: Workflow Task
- Open Task Rule Action: Keep default settings
- After submit: Keep default settings
- Summary: Save and Finish
- Recipients: Context Browser > Documents to Review and Approve REFERENCES > Approvers
- Use the drop-down for the Originator bar, then select Type/Construct my own. Delete the FQN value and add the Approvers reference.
- Email Alert: Customize the task notification to include Context Browser references. Attach the Document (File) reference to the email.
- Results/Voting: Change the rule to Consensus, with Rejected being the followed outcome if there is not a consensus.
- Properties: Rename the step: Approve Document
- Connect the Approve Document step to the Set Status Pending Approval step.
- Now, you are ready to add and configure the Task step for the document approval decision. Expand the Toolbox by clicking the slider. Click the Toolbox icon in the breadcrumb bar to return to the main menu.
- From the Toolbox > Basic node, drag a Task step below the Set Status Pending Approval step.
- Hover over the bottom border of the Set Status Pending Approval step to expose a handle, then drag the handle down into the Task step. Click the design canvas to set the outcome. (If the handle doesn't appear when you hover over the boarder, click anywhere in the design canvas to refocus your mouse. Then hover.)
- Select the Task step, then expand the Configuration Panel. Click the Task tab to make it active, if it is not already. For the INSTRUCTIONS, enter
Please review the attached document and indicate your approval decision. - Click the Add (+) icon under the ACTIONS heading to add the task actions:
Approved
Rejected - Click the Form tab. You will select the display form for the task steps, as you do not want the recipient to make changes to the original form entries.
- For the FORM TYPE, select SmartForm. For the FORM, browse to and select the Display Document form. Your menu structure may be different than the image below, depending on subsites and other naming conventions. Click OK.
- On the REFERENCES screen, notice that K2 has found the Documents to Review and Approve SmartObject reference. Click NEXT.
- On the OPEN TASK screen, select Help me configure it, then click NEXT.
- On the WORKFLOW VIEW screen, confirm the option to Create a new State has the Workflow Task state. Click NEXT.
- There are no changes to the OPEN TASK RULE ACTION screen, click NEXT.
- There are no changes to the AFTER SUBMIT ACTION screen, click NEXT.
- On the Summary screen, review the settings, then click SAVE AND FINISH. When you see the green success check, click OK to close the wizard.
- Click the Recipients tab. (See the image below for tab location.)
- Click the Originator bar. From the drop-down options, select Type/Construct my own.
- The recipient value changes to Originator's FQN. Expand the Context Browser. Expand the Documents to Review and Approve SmartObject under the REFERENCES heading. Drag the Approvers property into the Originator's FQN bar. This will add the Approvers property to the recipient bar.
- Select the Originator's FQN reference, then click <DELETE> on your keyboard. This removes the default value, leaving the Approvers reference as the sole recipient entry.
- Click the Email Alert tab. CHECK the Customize Notification option. Notice that the SUBJECT and BODY fields are now editable. For the SUBJECT, enter
Document submitted for your approval:
then drag the Title from the Documents to Review and Approve reference and append it at the end of the line. - Scroll down to the bottom of the notification screen. You see the ATTACHMENT box. Click the Add Attachment link. Drag the Document (File) reference into the ATTACHMENT box. You are adding a reference to the current document as an attachment to this email. At runtime, the current document is attached to the email.
- Add additional content to the email BODY so the recipient knows what to do. For example:
A document is waiting your approval. Please review the attached document and indicate your approval decision in one of the following ways: - Click the Results/Voting tab. Select the Consensus option under the TASK RESULT RULE, then change the non-consensus value to Rejected. This is saying that all recipients must approve the document, or it is rejected.
- The last configuration is to rename the step. Click the Properties tab. Change the name to
Approve Document
then collapse the Context Browser, then Configuration Panel.
Next, you will connect the two steps.
The Open Task on a Form wizard launches.
The default recipient is Originator. You want the Approvers property from the Documents to Review and Approve reference. At runtime, this property contains the value(s) entered by the workflow originator.
Next, you will configure the task notification email using properties once again from the Context Browser.
Next, you will attach your document to the email.
Email variables explained:
Worklist Item Link: This link opens the worklist item (user task). You can action (make a decision on) the item from the worklist item screen.
Configured Actions: At runtime, K2 replaces this variable with the actions you configured for the task. For example, approved or rejected. You can reply to the email and enter one of the actions in the reply message body. K2 will read the action and move the workflow along according to the outcome rules. K2 refers to this technology as SmartActions.
Standard Actions: Examples include: Redirect, Delegate and Sleep. Redirect sends the user task to another user and removes the task from the current user's worklist. Delegate sends the task to another user, but keeps the task open for the current user as well. Sleep pauses the worklist item. This is helpful if the user is going to be unable to action the task in the time allotted (if you specified a time allotment).
Next you will configure the outcome rules for the Approve Document step. (You will name the step in a few minutes.) All approvers must approve the document to send the workflow along the approved outcome. If one or more approvers rejects the document, the workflow follows the rejected outcome.
-
Add a Decision step and connect it to the Approve Document step. There are no other configurations necessary. The Decision step generates the outcomes for the Task step. There is one outcome per action, so in this case two outcomes: Approved and Rejected.
- Decision steps generate outcomes and provide tools for setting rules on outcomes. In this case, there are no rules to configure, so you will just add the Decision step and connect it to the Approve Document step.
From the Toolbox > Logic node, drag a Decision step below the Approve Document step. Connect the two steps. Notice that the actions configured in the task step are now generated as outcomes from the decision step.
Your workflow should look like the image below at this point.
- Decision steps generate outcomes and provide tools for setting rules on outcomes. In this case, there are no rules to configure, so you will just add the Decision step and connect it to the Approve Document step.
Review
In this step, you added a Task step and configured it for the document approval decision. You assigned the task recipient to the Approvers (SmartObject) reference. At runtime, K2 creates a task for each approver selected (on the original submit form). Each approver must "approve" the document for the workflow to follow the Approved outcome. This is known as consensus. If one approver rejects the document, the workflow follows the Rejected outcome. You learned how to add a document as an attachment to an email and how to personalize the email using references from the Context Browser. In the next step, you will configure the steps for the Approved outcome. If approved, K2 moves the document to the Approved Documents library.