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:

  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": ""  } ]

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.