- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2024 02:39 PM - edited ‎12-31-2024 02:47 PM
Xanadu
I have script that is called in the Service Catalog Item Workflow post approval. It is trivial
When I print the payload using gs.log(JSON.stringify(payload),"RITM Debug"); External Catalog ID is null.
But, if I print just the value gs.log("External Catalog ID" + grCatItem.u_external_catalog_id,"RITM Debug");
the value is logged.
What am I doing wrong?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2024 03:49 PM
Can you try below and print? That would convert the id to a string.
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2024 03:49 PM
Can you try below and print? That would convert the id to a string.
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2024 06:40 PM
@Sanjay Rallapal Try updating the payload as follows and see if it works.
var payload = {
"requester": current.opened_by.getDisplayValue(),
"approver": approvalGR.approver.getDisplayValue(),
"approverComments": "",
"approvalDate": "2025-01-01",
"itemId": grCatItem.sys_id,
"External Catalog ID": grCatItem.getValue('u_external_catalog_id')// custom attribute defined in the sc_cat_item table
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-31-2024 08:14 PM
try this
you need not query RITM as your current object holds reference to RITM table only
var details = "Requested Item Details:\n";
// Get the current request item
// Get the corresponding catalog item
// 2. Query approvals related to this RITM (sc_req_item) record
var approvalGR = new GlideRecord('sysapproval_approver');
approvalGR.addQuery('sysapproval', current.sys_id);
approvalGR.query();
if (approvalGR.next()) {
var payload = {
"requester": current.opened_by.getDisplayValue(),
"approver": approvalGR.approver.getDisplayValue(),
"approverComments": "",
"approvalDate": "2025-01-01",
"itemId": current.cat_item.sys_id,
"External Catalog ID": current.cat_item.u_external_catalog_id // custom attribute defined in the sc_cat_item table
};
}
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
‎01-01-2025 07:02 PM
Thank you for marking my response as helpful.
As per new community feature you can mark multiple responses as correct.
If my response helped please mark it correct as well so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader