Call UI actions with REST using ServiceNow OOTB way – UPDATED

Note: this out of the box method is only available from Madrid version and up, if you are using prior versions click here.

Ever since Agent Workspace was introduced work has started to lose dependencies from interacting with Jelly and Java pages which led to introduction of GraphQL and other OOTB REST functionally.

One of them, which was previously only possible through some what complicated scripting, is calling UI actions.

A new way is simple and straightforward.

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:

  1. sysparm_table – table name of UI action.
  2. sysparm_sys_id – sys_id of the record you want to run UI action against.
  3. 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": ""  } ]