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

alert() method is only available on client side, it is not available for server side scripts like Business Rules, Script Includes. You can instead use gs.addErrorMessage(), gs.addInfoMessage() methods which are available on server side.


My bad.   I was thinking it's still the client script.



I've changed to use gs.addInfoMessage() on the script.   Where can I see the test message?


when you change state to "Awaiting Evidence" on the incident form click save or update, your business rule is triggered and   you should see the message on top of the incident form


I see the message on top of the incident page now.   But the page content becomes the definition of Script IncludeKeylinesBsmAJAX code instead of the original incident form page.


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.