How cancel change UI page is called from UI action?

rohitservicenow
Mega Guru

Hi,

I have been trying to understand, how cancel change ui page (change_confirm_cancel) is called from UI Action

 

rohitservicenow_0-1668404678585.png

 

To me, line 1 looks just like a variable declaration and it's not doing anything.

Tried checking the UI scripts with no luck. Can someone help me understand how the UI page is called and a dialog window is presented?

 

Thanking you in advance

 

1 ACCEPTED SOLUTION

Hi @rohitservicenow ,

If you wanted to cancelled the change request without any dialog then make modification in UI action as below :-

//var changeConfirmCancelDialog;

function setChangeCancelState() {
	gsftSubmit(null, g_form.getFormElement(), 'state_model_move_to_canceled');   // Action Name 
}
if (typeof window == 'undefined') {

current.state= '4';
current.update();

//will be on the current page after UI action
action.setRedirectURL(current);

}

Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

View solution in original post

5 REPLIES 5

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @rohitservicenow ,

Below is the onChange client script on change request table'.

on Change of state ==4, the client script start executing

Client Script :-

GunjanKiratkar_0-1668407444360.png

 

 

 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

Hi @rohitservicenow ,

If you wanted to cancelled the change request without any dialog then make modification in UI action as below :-

//var changeConfirmCancelDialog;

function setChangeCancelState() {
	gsftSubmit(null, g_form.getFormElement(), 'state_model_move_to_canceled');   // Action Name 
}
if (typeof window == 'undefined') {

current.state= '4';
current.update();

//will be on the current page after UI action
action.setRedirectURL(current);

}

Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

Thank you Gunjan, now I know that 'Cancel Change' ui action just updates the state to cancel and this onChange script shows the ui page. 

Could you help me understand what exactly the first line of code is doing? How will it deactivate the client script showing the dialog window?

Hi @rohitservicenow ,

That first line is not deactivating the client script. First line is just kind of variable nothing else.

The client script call's itself when UI action changes it's state to cancelled. Client Script runs on change of state to cancelled and then ultimately popup window appears from client script itself.


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy