How to trigger outbound REST API when State is change?

jackh
Kilo Contributor

Hi,

My use case requires to call external REST API from ServiceNow when the incident state is changed.   For example, our release pipeline will create a new incident (via inbound REST API call) for someone to approve this release.   Once the incident assignee approves the ticket by changing the State (e.g. from New to Approved), it will trigger to call outbound REST API to our release pipeline.   How to do that in ServiceNow to trigger such outbound API when State is changed?


Any advice would be appreciated.

Thanks

1 ACCEPTED SOLUTION

That is because, when you click "Update" you are redirected to the recent page you opened. When you click save, you can still stay on the same incident form even after updating the form.


View solution in original post

22 REPLIES 22

Srinivas Balusu
Kilo Guru

Check this for more information.



find_real_file.png


Outbound REST Web Service - ServiceNow Wiki


The ServiceNow Wiki content is no longer supported. Updated information about this topic is located here:
Outbound REST Web Service




Visit http://docs.servicenow.com for the latest product documentation


Ashok Katam
Mega Guru

You can have onChange client script on state field and check if the new State is APPROVED, then call the script include from client side


in Script include, you can have script for your outbound REST web service


Please allow me to ask a silly question. Where can i see such onChange code for my UI?


I did not understand what do you mean by "onChange code for my UI?"



But you can find client scripts under 'System Definition' and filter the Type as onChange, you can see lot of example scripts