Fetch Response details and update worknote
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2025 07:00 AM
hi
I am using REST method to POST. this is triggered via script include.
in outbound Http log .
please suggest how to fetch this message in script include.
Thanks
Ujjwal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2025 07:10 AM
share the complete script here
you should be able to get the response body like this using the OOTB function of REST Message
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('EndPoint');
request.setHttpMethod('POST');
//Eg. UserName="admin", Password="admin" for this code sample.
var user = 'admin';
var password = 'admin';
request.setBasicAuth(user,password);
request.setRequestHeader("Accept","application/json");
request.setRequestHeader('Content-Type','application/json');
request.setRequestBody('{"u_catalog_item":"Blackberry",' +
'"u_variables":"original^299-999-9991|' +
'replacement^Yes"}');
var response = request.execute();
gs.log(response.getBody());
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
05-05-2025 06:09 AM
thanks @Ankur Bawiskar for response.
with response.getBody()
i am getting below response(captured in gs.log)
but in outbound Http log below message is captured. how to get this in script include.
please suggest
Thanks
Ujjwal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2025 06:14 AM
it's giving error 500 means some internal server error and hence returning some HTML content
Did you check with 3rd party team regarding this?
what's your next requirement, you already got the response body printed in logs?
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
05-05-2025 07:57 AM
issue is .. i need to update worknote with response message. but i am not getting reponsebody message in script include.