How to cancel approvals and change if scheduled starts has passed.

karishma
Mega Expert

Hi,

Is there any way to cancel the change and approvals if scheduled starts has passed before approving the change request.

Please suggest.

1 ACCEPTED SOLUTION

You can create a branch activity and one branch link to approval

Another branch link to timer activity which wait till schedule start date. Once it is crossed add a run script activity and check if the change is approved or not.

If not approved, then you can use the above code and cancel the approvals and end the workflow.

Mark the comment as a correct answer and helpful if it helps.

View solution in original post

22 REPLIES 22

asifnoor
Kilo Patron

Hello Karishma,

You can cancel a WF like this

var workflow = new global.Workflow();

workflow.cancel(current);

You can use the same logic of adding a wait for condition or follow the process that i suggest to you in another thread. Adding a event and add associated script action.

For cancelling approvals

var gr= new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval',current.getValue('sys_id'));
gr.approval='cancelled';
gr.updateMultiple();

i want to do it using workflow.If scheduled starts passed and then i want to cancel the approvals and change and end the workflow

You can create a branch activity and one branch link to approval

Another branch link to timer activity which wait till schedule start date. Once it is crossed add a run script activity and check if the change is approved or not.

If not approved, then you can use the above code and cancel the approvals and end the workflow.

Mark the comment as a correct answer and helpful if it helps.

Hi,

Below is my workflow. Where should i use timer and branch activity.

find_real_file.png