Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 04:01 AM
Hi,
can you share what the incoming request/endpoint will look like and what script did you try so far?
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 04:06 AM
yes , thanks.
I add the code in the question description.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 04:45 AM
script will look like this
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
try {
var arr = [];
var itemName = request.pathParams.itemname;
var ritm = new GlideRecord("sc_req_item");
ritm.addQuery("cat_item.name", itemName);
ritm.setLimit(2);
ritm.query();
while(ritm.next()) {
arr.push(ritm.getValue('number'));
}
var responseBody = {};
responseBody.data = arr;
responseBody.status = "Success";
response.setBody(responseBody);
}
catch (ex) {
var message = ex.message;
}
})(request, response);
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 06:03 AM
thanks, it worked.
> ritm.getValue('number')
helped me.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 06:19 AM
Glad to know.
Please mark response helpful as well.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader