How to add key and value in the response we got from rest message?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 01:41 AM - edited 02-20-2025 01:47 AM
Hi Team,
I am fetching response from restmessage but from there I am getting company name, start date and end date,
start date and end date I am able to populate on change form, but for company name which is reference field I am trying to fetch sys_id from the same script include which is I am using to call rest message and fetch the responseBody and I am passing that responseBody to the client side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 04:29 AM - edited 02-20-2025 04:29 AM
Hi @Ankur Bawiskar ,
currently a response I am getting error message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 04:30 AM
you can't test unless you get an API response
try to hard-code the API response and see if it works, if yes then it will work when you get actual API response as well
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 04:34 AM
Hi @Ankur Bawiskar ,
Can't I add sys_id in response Body and make one single object, because in future I may need few may parameters from response body and for me its easy when its I am fetching response body into client side
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 04:40 AM
that's what I am doing. forming single json object in script include and returning complete json
then in client side parsing it
In future you can update code in script include and also in client side
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 09:42 PM