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.

3 thoughts on “Call UI actions with REST using ServiceNow OOTB way – UPDATED”

  1. Can you help with more details. I am trying to accomplish this using powershell. But, no luck.

    $url = “https://xxxx.service-now.com/api/now/ui/ui_action/4195eda1eb1211004d7763fba206fe54?sysparm_table=em_alert&sysparm_sys_id=7b0baf69dbf8d0903573f572f3961931&api=api”

    Invoke-RestMethod -Method Post -Uri $url -ContentType ‘application/json’ -Credential $credentials

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s