How I can Bypass Change Approval?

Naveen63
Tera Contributor

How I can Bypass Change Approval?

Requirement: I have one user named “Change Master” when he/she click on “Close Change” (custom btn). Change automatically goes to “Closed” state.(bypass all the approvals)

Any ideas would be greatly appreciated.

 

1 ACCEPTED SOLUTION

Pranay Tiwari
Kilo Guru

Hi Naveen,

You need to write your UI Action as below..

 

var gr = new GlideRecord("change_request");
gr.addQuery("sys_id",current.sys_id);
gr.query();
if (gr.next()) {
	gr.setValue("short_description","close");
	gr.setValue("state",3);
	gr.update();
	
	action.setRedirectURL (current) ;
	
}

 

My concept is,when you click on close change button then state=closed && short description=close,as i mention.

Now what you do with Workflow...

1st you need to create one workflow condition as below..,

 

 

and transition it to the END.

To achieve this you need to write Approval script, there you will check approval is approved or not and one more condition if(current.short_description=="close"){

answer="close"}

 

so whenever you click on close change ,the short_description will be "close " by UI action.

and the close condition meet so we connect approval close to END(connect every close node(IN APPROVAL ACTIVITY) to END) ,so when ever close condition meet workflow will END, AND Skip all approval.

 

Hope you will understand the logic.

 

Mark correct or helpful if it helps you.

 

Warm Regards,

Pranay Tiwari

| www.DxSherpa.com | pranay.tiwari@dxsherpa.com |

View solution in original post

9 REPLIES 9

i think one activity can fulfill the approval requirement you just need to mention that if block in advanced script section in activity.

var us = gs.getUserID();

if(us=='change master sys id')

{

 

//approval will skip

}

else {

 

//approval will go

}

 

one question i have 

currently change manager is not able to see that UI Action?

Naveen63
Tera Contributor

Hi Harsh,

 

Okay, I will try in my development environment. 

 

Yes, Change Manager is able to see UI action(Close Change Button).

 

And Thanks for the quick response.

 

just give a try . make sure you made the changes in approval activity . once you will open that activity you will see the advanced check box .. click on that and write any dynamic approval you want. 

let me know if you need any further help.

Nitesh Balusu
Giga Guru

If you want the 'change master' to close the change when it's in any state, instead of using the workflow, why don't you use the UI Action "Close Change" itself to close the change.

 

In the UI Action,

 

You can just write 

if(gs.getUser=='change master')

{

current.state='closed';

current.active=false;

current.update();

}

Pranay Tiwari
Kilo Guru

Hi Naveen,

You need to write your UI Action as below..

 

var gr = new GlideRecord("change_request");
gr.addQuery("sys_id",current.sys_id);
gr.query();
if (gr.next()) {
	gr.setValue("short_description","close");
	gr.setValue("state",3);
	gr.update();
	
	action.setRedirectURL (current) ;
	
}

 

My concept is,when you click on close change button then state=closed && short description=close,as i mention.

Now what you do with Workflow...

1st you need to create one workflow condition as below..,

 

 

and transition it to the END.

To achieve this you need to write Approval script, there you will check approval is approved or not and one more condition if(current.short_description=="close"){

answer="close"}

 

so whenever you click on close change ,the short_description will be "close " by UI action.

and the close condition meet so we connect approval close to END(connect every close node(IN APPROVAL ACTIVITY) to END) ,so when ever close condition meet workflow will END, AND Skip all approval.

 

Hope you will understand the logic.

 

Mark correct or helpful if it helps you.

 

Warm Regards,

Pranay Tiwari

| www.DxSherpa.com | pranay.tiwari@dxsherpa.com |