- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2022 08:43 AM
Hello,
I am creating a new UI Action button to cancel a RITM and the associated child task as well as display an info message notifying the user that the record was canceled, however, when I click the button my page refreshes but the record is not updating. My log statements are not showing. When I try to run with the Client box checked the button does not work.
function cancelRITM() {
g_form.setValue('state', 7);
current.update();
gs.addInfoMessage('Task has been cancelled');
action.setRedirectURL(current);
}
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2022 08:56 AM
Hey @Fred Abram III,
you are mixing client and server side stuff in this script.
You need to do your client side stuff and then re-call the UI action by using the action name. Once you have called the action name, the server side script will be executed.
Have a look at this ServiceNow support article for a detailed instruction: How to use client and server side code in UI actions without errors
If i was able to help you or even better to solve your query then please mark my comment Helpful and/or Correct.
Thanks and best regards
Oli
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2022 08:56 AM
Hey @Fred Abram III,
you are mixing client and server side stuff in this script.
You need to do your client side stuff and then re-call the UI action by using the action name. Once you have called the action name, the server side script will be executed.
Have a look at this ServiceNow support article for a detailed instruction: How to use client and server side code in UI actions without errors
If i was able to help you or even better to solve your query then please mark my comment Helpful and/or Correct.
Thanks and best regards
Oli
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2022 09:46 AM
Thanks, I was able to get it to work