We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Search Scriptable API

Harshit Sharma1
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

@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

Try

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