This article will show you how to cancel a request after a specific time if it is not completed.
Use case: the client has COOP students that launch requests. Usually those COOP students leave the company after a year. If a request is launched by a COOP student, we want to make sure the request is cancelled after a year if it is not completed.
Setup:
1. Open a parallel CANCELREQUEST action and set the Delay/Start time to 1 Year. **Uncheck** the "**Use working days/hours to calculate the duration**" and "**Skip delay for the first execution when action is in direct loop**" options.-
In the CANCELREQUEST action, go to the parameters tab and set the REQUEST_ID parameter to the macro “Request.Id” so that the action will cancel the current request.
-
Add a COPYDATA action after the CANCELREQUEST action and call it “DO_NOTHING”. Transition that action to an endpoint. This allows the workflow to properly close the request in case the CANCELREQUEST is no longer needed.
-
Add an “Action cancellation” transition from CANCELREQUEST to “Do nothing” action.
-
At the end of your process, before closing the request, add a RAISEEXCEPTION action that will cancel the CANCELREQUEST action. This will close the parallel action, which will then lead to properly close the request.
-
In the RAISEEXCEPTION action, go to the parameters tab and set
a. The REQUEST_ID parameter to the macro “Request.Id”
b. The ACTIVITY_NAME parameter to the value of the action name used in CANCELREQUEST, in this case it’s “CANCEL_REQUEST”.
c. The IGNORE_NOTHINGTODO_ERROR parameter value and set it to “Y”. This will prevent the request from cancelling in case there is no action to cancel. In this scenario, this will handle the case where the request is not opened for a COOP student.