Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2022 12:48 AM
1 ACCEPTED SOLUTION
Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2022 01:37 AM
Hi @ramancoder ,
If you want to fetch data for multiple records and send a response, then you need to use an array of objects. Here's how the code will look like:
var output = [];
var gr = new GlideRecord('incident');
//add your encoded query here
gr.query();
while(gr.next()){
var temp = {};
temp[gr.number] = gr.description.toString();
output.push(temp);
}
​
response.setBody(output);
Feel free to mark correct, If I answered your query.
Will be helpful for future visitors looking for similar questions. 🙂
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2022 03:11 AM
Arent you still setting the body into the response rather than the request? Seems backwards to me....
Richard