Triggering UI Action through Rest Api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 06:41 AM
I'm trying to trigger UI action through the Rest API call. How can I trigger UI action present on the Table level and not the record level. Being at the table level, 'sysparm_sys_id' is not available. This is causing the rest call to fail with the below error:
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 07:11 AM
I am curious about this approach- why would you want to trigger a UI action (interactive) via a non-interactive method (REST)?
Can you elaborate on what you're trying to accomplish? If you need to take action on a record or table, why don't you POST to the record or table itself via the Table API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2022 08:03 AM
We're trying to reduce some UI flows from our Selenium-based Automation framework (QTF) with the Rest API calls as they're quick and less flaky.
In the current scenario, We've to click on a button (UI Action) on a table. Prior step is already moved to API call.
I know how to trigger a UI Action on a record as it has some sys_id. But in my case, UI Action is present on Table so there'll be no sys_id. It is causing the Rest Call to fail.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2023 06:23 AM
Hello,
Can you please help me on how to call a form ui action via API Call?
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2023 06:36 AM
Hi @Gajendra Singh1 ,
I think it is not possible to trigger a UI action on a table level using the ServiceNow REST API. UI actions are designed to work on records, and therefore they require a sys_id to be passed in as a parameter. Without a sys_id, the API call will fail.
However, there might be an alternative way to achieve what you are looking for. You could consider creating a Script Include that performs the same action as the UI action you are trying to trigger. You can then call this Script Include using the ServiceNow REST API. This approach will allow you to execute the action without the need for a sys_id.
Once you have created the Script Include, you can call it using the ServiceNow REST API. Here's an example of how the API call might look like:
URI: https://xyz.service-now.com/api/now/table/<script_include_name>
Method: POST
Headers:
Content-Type: application/json
Accept: application/json
Body:
{
"param1": "value1",
"param2": "value2"
}
Shravan
Please mark this as helpful and correct answer, if this helps you