- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 09:48 PM
Hi,
I have been trying to understand, how cancel change ui page (change_confirm_cancel) is called from UI Action
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 10:46 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 10:32 PM - edited 11-13-2022 10:34 PM
Hi @rohitservicenow ,
Below is the onChange client script on change request table'.
on Change of state ==4, the client script start executing
Client Script :-
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2022 10:46 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 07:30 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2022 10:00 PM
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.