Search Scriptable API

Harshit Sharma1
ServiceNow Employee
ServiceNow Employee

Hi there,

 

Is there a way to print the entire  searchResults object returned by Search Scriptable API as a JSON?

2 REPLIES 2

Rahul RJ
Giga Sage
Giga Sage

@Harshit Sharma1   You can try to print using JSON.stringify(searchResults); method whatever result body you are getting 

 

var responseBody = response.getBody(); // Parse the response body as a JSON object

var searchResults = JSON.parse(responseBody); // Convert the searchResults object to a JSON string

var jsonResults = JSON.stringify(searchResults);

 

Please mark the answer correct/helpful based on Impact.

Regards,

RJ

 

Rahul Jain6
ServiceNow Employee
ServiceNow Employee

Try

response.getGeniusResults();
response.getSearchResults();