- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi I need to update the state field for our SC Tasks via the REST API but the field is protected I assume by a workflow and can only be updated by the UI Action buttons "In Progress", "Close Task" and "Cancel".
How can I trigger these UI Actions for specific SC Task numbers via the API?
I've asked various AI bots and some say you cant do it, some say can but then have hallucinated false ways of doing so
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Found the solution on a blog to which I cannot add the link to, but here is the solution:
Call UI actions with REST using ServiceNow OOTB way – UPDATED
Now you can execute UI Actions using OOTB REST API.
Note: this out of the box method is only available from Madrid version and up, if you are using prior versions click here.
There is only one endpoint to do POST call for UI actions.
POST @ /api/now/ui/ui_action/${sys_id_of_UI_action}
Additionaly, there are same 3 mandatory body parameters:
sysparm_table – table name of UI action.
sysparm_sys_id – sys_id of the record you want to run UI action against.
api=api (this has to be static).
If your UI action is designed to take additional parameters, you can pass them as well.
Note, if this is not working, you might need to set up Request header with Content-Type application/json and pass body parameters as following:
{
"fields": [ { "name": "" } ]
}
Also, if your UI action contains client side only code, like g_form, it has to be converted to server side for this to work, because without user session being present, g_form and other client side API’s will be equal to null.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Found the solution on a blog to which I cannot add the link to, but here is the solution:
Call UI actions with REST using ServiceNow OOTB way – UPDATED
Now you can execute UI Actions using OOTB REST API.
Note: this out of the box method is only available from Madrid version and up, if you are using prior versions click here.
There is only one endpoint to do POST call for UI actions.
POST @ /api/now/ui/ui_action/${sys_id_of_UI_action}
Additionaly, there are same 3 mandatory body parameters:
sysparm_table – table name of UI action.
sysparm_sys_id – sys_id of the record you want to run UI action against.
api=api (this has to be static).
If your UI action is designed to take additional parameters, you can pass them as well.
Note, if this is not working, you might need to set up Request header with Content-Type application/json and pass body parameters as following:
{
"fields": [ { "name": "" } ]
}
Also, if your UI action contains client side only code, like g_form, it has to be converted to server side for this to work, because without user session being present, g_form and other client side API’s will be equal to null.