UI Action - Confirm Yes/No (non Client Site)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 12:15 PM
Dear all,
I created the following UI Action to Cancel the request. This UI action will be use in both UI16 and Portal so I need to uncheck the Client checkbox so the Confirm Yes/No is not working. Is there a way to fix this?
I would appreciate your help.
______________________________________________________
function cancelTA() {
var answer = confirm("Are you sure you want to cancel this TA?");
if (answer == true)
{
gsftSubmit(null, g_form.getFormElement(), 'cancel_tr'); //Action name: cancel_tr
} else
{
return false;
}
}
if (typeof window == 'undefined')
{
var wflow = new global.Workflow();
wflow.cancel(current);
current.state = 4;
current.stage = 'TA Cancelled';
current.update();
action.setRedirectURL(current);
gs.addInfoMessage('The current TA has been cancelled.');
}
____________________
Regards,
Hong

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 12:36 PM
You need to do a client side check using a client script & server side logic can stay in Business Rule.
Follow link for a check.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2022 04:51 AM
Hi Jaspal,
If check the Client checkbox, the UI Action "Cancel" will not show in the Portal.
The link that you share does not use the Business Rule.
Regards,
Hong

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2022 12:44 PM
Hi,
I'd recommend checking out this article for assistance with getting a button to show up on the portal, etc.
So you can use client for the UI Action you have now, then add this for the portal side: https://community.servicenow.com/community?id=community_article&sys_id=b1588f6fdbcf011439445ac2ca961...
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!