- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2020 08:31 AM
Hi All,
We have recently integrated ServiceNow with Octopus using PowerShell scripts that create a change request and force state changes to avoid the manual UI process. However this has caused issues (emergency changes error out and users who are in an approval group can approve their own change requests). I have been looking for a way to use the API to call UI actions and avoid the issue of forcing state changes.
I have followed the instructions I found from this link (https://servicenowthink.wordpress.com/2019/10/15/call-any-ui-action-with-rest-api-or-ajax-ootb-updated/):
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.
When following these instructions exactly, I receive:
"fields": [ { "name": "" } ]
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2020 08:51 AM
We brought in a web developer to assist and he was able to use the admin side to write up a custom script/rule to stop the Requested By user from approving their own changes if they are a member of the approver group.
As I mentioned, this normally works out of box, but because we are using the API to force state changes from a PowerShell in Octopus, this breaks that rule. This custom script prevents that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2020 08:51 AM
We brought in a web developer to assist and he was able to use the admin side to write up a custom script/rule to stop the Requested By user from approving their own changes if they are a member of the approver group.
As I mentioned, this normally works out of box, but because we are using the API to force state changes from a PowerShell in Octopus, this breaks that rule. This custom script prevents that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2020 03:49 AM
If this is resolved, you can close the thread by marking suitable replies as helpful/Asnswered