- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 12:29 AM
Hi,
I have a requirement like, when user update state, Comments, Priority etc.. in third party application, then it should be updated in servicenow
I am using the scripted rest api PUT method to update the fields in servicenow.
Could you please help,
Script Include:
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 10:45 AM
Hi Harish,
As you said when ticket is updated in third party application then it should update the same in ServiceNow.
Are you saying that you have exposed the Scripted REST API to the third party.
I could see that you have used PUT method i.e. fine.
But the way you are fetching the response is incorrect . use following
var requestBody = request.body.dataString;
try to add logs to check requestBody is received correctly in your scripted rest api resource
also you are not sending the id as json key while consuming the REST endpoint so how you will get the value by parsing the json
the json parsing you have used is not correct. use following
var parser = new global.JSON();
var parsedData = parser.decode(requestBody);
var id = parsedData.work_notes;
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 03:30 AM
Hi Harish,
After seeing your screenshot I found this. Let me know if this is correct
1) Third party will consume your REST endpoint of instance A.
2) You will fetch the details in scripted rest api of instance A and update incident in instance A by matching the id json key with u_zendesk_ticket_id
3) Now from this scripted rest api of instance A you are consuming an endpoint of ServiceNow which is table API and trying to update incident in some instance
For step 3 which is the instance? Is it instance A or some other instance . If different instance then Why this loop to update the incident in instance B via instance A
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 03:39 AM
Hi Ankur,
Thanks for the response.
Yes, Third party will consume the scripted rest api end point.
When zendesk ticketing system(third party application) will update the incident state or priority or comments or status or subject in their application, then it should update in servicenow. so for this I am using the scripted rest api and providing endpoint to the zendesk to push the updates.
to accomplish this I am using script include and scripted rest.
I am sorry, If I confused you . Hope you got clarity.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 04:00 AM
Hi Harish,
So whenever ticket gets updated in third party application they should push the updates right?
For this you have developed scripted rest api. inside which you will get the details and parse and update the incident based on zen ticket id.
So it still didn't answer my question how many instances are involved here. since you are updating the incident in scripted rest api. then why you are consuming again servicenow endpoint?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 04:33 AM
Hi Ankur,
So it still didn't answer my question how many instances are involved here. since you are updating the incident in scripted rest api. then why you are consuming again servicenow endpoint?
A). Only 1 Instance is involved here i.e PROD instance after go-live.
For Testing I am using my personal developer instance to implement it and capture in update set.
Please let me know which method do I need to use in scripted REST API ? and What I needs to modify.
yes you are right, whenever ticket gets updated in third party application they should push the updates.
sorry for the confusion.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 04:42 AM
Hi Harish,
Ok so the way you are consuming your demo instance end-point in the scripted rest api is having some concern.
endpoint seems correct along with PUT method.
what response you are getting in line number 20 in scripted rest api?
is the incident not getting updated with short description?
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader