Q: My business usecase is a workflow app where employees fill out timesheets and submit them for approval. One of the requirement for the app is that when an employee starts filling out a new timesheet but decides to cancel it, the created workitem must be removed from the workflow. How do I design for this functionality?
A: To cancel a workitem that is opened by mistake or to remove an unfinished workitem from the workflow, you need to link the action to a BOS. Within the BOS, add the 'Archive' block, which effectively cancels or removes the created workitem.
Note
The following steps explain only the 'Cancel/Remove Workitem' functionality. The other parts of the Timesheet app are not covered.
Steps:
To cancel a work item, follow these steps:
- Add a 'CancelTimesheet' BOS to the Timesheet page.

- Within the BOS, incorporate an onCloud component.
- In the Input Variables section, select the 'id' variable from the Workitem Variables dropdown list.
- Drag and drop the 'Archive' block from the workflow component.
- Assign the 'id' variable to the WorkflowId field.

- On the Timesheet page, configure the 'Cancel' button interactions as follows: onClick - Navigate to - CancelTimesheet.

By implementing these steps, the opened work item will be effectively canceled.