How to send request to third party application after approval of request?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2016 10:51 PM
Hi, I am trying to call the third party application using script in service now workflow.When someone request a item from service now catalog It goes for approval to admin.Once admin approves the request incident status is approved.But before ending the workflow I want to run script to call some third party application API and do some task using script.
Thanks, Vimal Mishra |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2016 11:12 PM
Hi,
First : Yeah it's possible to call third party application.
Second: To call third party application you must have knowledge of SOAP or REST web services. For this u have to write a SOAP or REST script in 'script action' and create a event, attach your script action to the even and you can call that event in the workflow.
For more info about Web service, Please go thought Web Services - ServiceNow Wiki .
If it's helpful, please mark as correct or helpful.
Thanks,
Veeresh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2016 12:11 AM
Hi Veeresh,
Thanks for the reply.
I am using ruing Run Script from the utilities section to make call to third party application.I am very new to this so I don't know how to write script in that,Please find following script that I have added :
var r = new RESTMessageScripted("get","http://<hostname>/auth/signin");
r.addHeader("Content-Type","application/json");
r.addHeader("Accept","application/json");
r.setBasicAuth("username","passowrd");
var response = r.execute();
gs.log(response.getBody());
I am getting following error whwn I run the script:
Caught exception in InterpretedScript <refname>: org.mozilla.javascript.JavaScriptException: ReferenceError: "RESTMessageScripted" is not defined.
(#0(eval); line 1)
Thanks,
Vimal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2016 11:15 PM
Hi Vimal,
Yes, you can definitely call third party app from workflow script.
If you are trying to call this third party app using a rest web service, then you can create a "Rest Message" in workflow to complete your request.
Else you can let me know as how do you want to call your third party application from workflow?
Thanks and Regards,
Vikas Malhotra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2016 12:18 AM
Hi Vikash,
Thanks for the reply.
I am using ruing Run Script from the utilities section to make call to third party application.I am very new to this so I don't know how to write script in that,Please find following script that I have added :
var r = new RESTMessageScripted("get","http://<hostname>/auth/signin");
r.addHeader("Content-Type","application/json");
r.addHeader("Accept","application/json");
r.setBasicAuth("username","passowrd");
var response = r.execute();
gs.log(response.getBody());
I am getting following error whwn I run the script:
Caught exception in InterpretedScript <refname>: org.mozilla.javascript.JavaScriptException: ReferenceError: "RESTMessageScripted" is not defined.
(#0(eval); line 1)
Thanks,
Vimal