25. Edit the Display Expense Claim Form
In this step, you edit the display form used for the Approve Expense Claim and Finance Processing steps of the workflow. You are using the same form and state for both task steps. Because there are two task steps involved, you must make sure you have conditions in place that check which of the two steps you are currently on. Any actions added to a condition apply to the task step specified. (You have two conditions, one that checks to see if the current step is Approve Expense Claim and another that checks to see if the current step is Finance Processing.) You confirm the worklist item (this is the task assigned) is mapped to the correct task step. Finally, you save any comments entered to either the Approver Comments or Finance Comments SmartObject properties (depending on which recipient entered the comments).
- First, confirm the worklist items are mapped correctly to their respective workflow task steps. Check out and edit the Display Expense Claim form. Edit the form initializing rule for the Workflow Task state.
- In this step, you are confirming the worklist items (these are the assigned tasks) are mapped to the correct workflow task step. Check out and edit the Display Expense Claim form.
- From the RULES screen, edit the When the Form is Initializing rule for the Workflow Task state. This is the rule that controls the behavior when the form first loads.
- Locate the if current Workflow Activity is Approve Expense Claim condition. Locate the action that says then open the Approve Expense Claim worklist item. Click (configure).
- Input Mappings: Confirm the Serial Number text box shows the SerialNo value. If it does not, map the Parameters > SerialNo to the Serial Number mapping destination.
- Output Mappings: Confirm the Expense Claim and Expense Claim Line Item - Item References are mapped to their respective views. If they are not, map the Item References.
- Locate the if current Workflow Activity is Approve Expense Claim condition. Locate the action that says then open the Approve Expense Claim worklist item. Click (configure).
- On the Input Mappings screen, confirm the Serial Number destination shows SerialNo as its value. If it is not mapped, map it from the Context Browser > Display Expense Claim form > Parameters properties.
- Click the Output Mappings tab. Confirm the Expense Claim and Expense Claim Line Item - Item References are correctly mapped to their respective views. If they are not, map the Item References. Click FINISH.
- Repeat the steps above for the Finance Processing worklist item action. Confirm the Serial Number contains the SerialNo parameter. Confirm the item references (Expense Claim and Expense Claim Line Item) are mapped to their respective views. If not, map the references.
- Click the configure link for the Finance Processing worklist item action.
- On the Input Mappings screen, confirm the parameter SerialNo is mapped to the Serial Number mapping destination.
- Switch to the Output Mappings screen. Once again, confirm the three Item References are correctly mapped to their respective views. If not, map the Item References. Click FINISH, then OK to close out of the rule designer.
- Next, add actions to save the approver and finance processor comments to the Expense Claim SmartObject. Recall that you added a separate view called Task Comments to the display view. The Task Comments view captures any comments or questions from the approver or finance processor (since they cannot edit the display form).
Edit the When the Workflow View is being submitted rule of the Workflow Task state. Add a condition that checks if the current activity is Approve Expense Claim.
- Ultimately, you want to save the approver's or finance processor's comments back to the Expense Claim SmartObject. Because you are using the same state (Workflow Task) for both approver and finance processing steps, you must add a condition that checks to see which step you are on before saving the comments.
Click the Workflow Task state, then click When the Workflow View is being submitted. Edit the rule. This rule executes after you click the submit button.
- With the Conditions tab active, click a Workflow Activity is specified to add it to the rule definition pane. Use the select worklist item link to select the Approve Expense Claim activity. If the condition is true, you are on the Approve Expense Claim step and can add actions specific to that step. In this case, saving the approver comments to the SmartObject.
- Configure the condition. Map the Display Expense Claim > Parameters > SerialNo to the Serial Number mapping destination.
- Click (configure). Map the SerialNo parameter to the Serial Number mapping destination. The serial number links the current workflow instance to this condition. Click OK.
- Execute a View method. Configure the action to call the Update List Item method of the Display Expense Claim view. Map the Task Comments Text Area to the Approver Comments input property. Map the Parameter ID to the ID input property (so that K2 knows which record to update).
- With the Actions tab active, click Execute A View method. Configure the method to call the Update List Item method of the Display Expense Claim view. Click (configure).
- On the Input Mappings screen, map the Parameters > ID to the Input Properties > ID. Map the Task Comments view > Controls > Task Comments Text Area to the Input Properties > Approver Comments. Click FINISH to complete the action configuration. In this step, you are mapping any comments entered by the approver back to the SmartObject, using the ID of the current workflow process (to determine which record to update).
- Add a second condition that checks if the current activity is Process Expense Claim. Map the parameter SerialNo.
- Next, you repeat the steps above to add the comments for the Finance Processing step.
From the Conditions tab, add another a Workflow Activity is specified condition. Configure the condition so that it checks if this is the Finance Processing task.
- Click (configure). Map the Parameter > SerialNo to the Serial Number mapping destination. Click OK.
- Execute a View method. Configure the action to call the Update List Item method of the Display Expense Claim view. Map the Task Comments Text Area to the Finance Comments input property. Map the ParameterID to the ID input property (so that K2 knows which record to update).
- Add an action to close the browser window. Finish the form designer.
- Add an action to close the browser window. Click OK to complete the rule configuration.
- This completes the rules setup for the display form. Click FINISH to complete the form designer and return to the K2 Application elements page.
Review
In this step, you added workflow integration rules to the display form used for the approver and finance processing steps. Because the two steps use the same display form, you configured a condition that checks to see which step you are currently on: Approve Expense Claim or Finance Processing. If the condition is true, any actions that follow apply to the specified step. You added actions to save any comments entered back to the relative column (Approver Comments or Finance Comments) in your SharePoint list. In the next step, you check in views and forms so that the K2 server has the latest versions.