# Set a timer to Cancel a Request

**URL:** <https://discuss.workflowgen.com/t/set-a-timer-to-cancel-a-request/2253>\
**Category:** General WorkflowGen Discussion\
**Created:** [October 22, 2024, 6:51pm UTC](https://discuss.workflowgen.com/t/set-a-timer-to-cancel-a-request/2253 "2024-10-22T18:51:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)\
**Post date:** [October 22, 2024, 6:51pm UTC](https://discuss.workflowgen.com/t/set-a-timer-to-cancel-a-request/2253/1 "2024-10-22T18:51:41Z")

</div>

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. 
1. 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.

2. 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.

3. Add an **“Action cancellation”** transition from CANCELREQUEST to “Do nothing” action.

4. 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.

5. 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.

## How the process will look like:
![image|403x500](upload://yAACTxNmVAb5IFeUjYTuoL9U79D.png)

---

<div class="post-metadata">

**Author:** ![pjsaini](https://avatars.discourse-cdn.com/v4/letter/p/c5a1d2/32.png) [@pjsaini](https://discuss.workflowgen.com/u/pjsaini)\
**Post date:** [October 28, 2024, 10:41pm UTC](https://discuss.workflowgen.com/t/set-a-timer-to-cancel-a-request/2253/2 "2024-10-28T22:41:26Z")

</div>

Can you post the image? @eddy.daouk
