- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2025 07:37 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2025 07:41 AM
try this
I assume field "ritm_ssw_number" is string type
gs.info("START - Match CDL from Sales Table SG/SSG/Attributes Status");
var count = 0;
var grCD = new GlideRecord('u_client_delivery_custom_fullfiller_view');
grCD.addEncodedQuery("u_custom_req_item.numberINRITM17518582,RITM17518588");
grCD.setLimit(2); // Change the number based on the # of records in the environment.
grCD.query();
while (grCD.next()) {
var grSales = new GlideRecord('x_amspi_acn_asb_dsm_sales_report');
grSales.addQuery('ritm_ssw_number', grCD.u_custom_req_item.number);
grSales.setLimit(2);
grSales.query();
while (grSales.next()) {
if (grSales.sg_ssg_attributes_status != grCD.u_sg_ssg_attributes_status) {
grCD.u_sg_ssg_attributes_status = grSales.sg_ssg_attributes_status;
grCD.update();
count++;
}
}
}
gs.info("Count of updated records [CDLv2]: " + count);
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
‎03-12-2025 07:44 AM
This line is using incorrect syntax so it will either be ignored causing a random record to be returned, or the script will fail
grSales.addQuery('ritm_ssw_number' + grCD.u_custom_req_item.number);
Use one of these options
grSales.addQuery('ritm_ssw_number' , grCD.u_custom_req_item.number);
grSales.addEncodedQuery('ritm_ssw_number=' + grCD.u_custom_req_item.number);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2025 07:41 AM
try this
I assume field "ritm_ssw_number" is string type
gs.info("START - Match CDL from Sales Table SG/SSG/Attributes Status");
var count = 0;
var grCD = new GlideRecord('u_client_delivery_custom_fullfiller_view');
grCD.addEncodedQuery("u_custom_req_item.numberINRITM17518582,RITM17518588");
grCD.setLimit(2); // Change the number based on the # of records in the environment.
grCD.query();
while (grCD.next()) {
var grSales = new GlideRecord('x_amspi_acn_asb_dsm_sales_report');
grSales.addQuery('ritm_ssw_number', grCD.u_custom_req_item.number);
grSales.setLimit(2);
grSales.query();
while (grSales.next()) {
if (grSales.sg_ssg_attributes_status != grCD.u_sg_ssg_attributes_status) {
grCD.u_sg_ssg_attributes_status = grSales.sg_ssg_attributes_status;
grCD.update();
count++;
}
}
}
gs.info("Count of updated records [CDLv2]: " + count);
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
‎03-12-2025 08:20 AM
This works. Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2025 07:44 AM
This line is using incorrect syntax so it will either be ignored causing a random record to be returned, or the script will fail
grSales.addQuery('ritm_ssw_number' + grCD.u_custom_req_item.number);
Use one of these options
grSales.addQuery('ritm_ssw_number' , grCD.u_custom_req_item.number);
grSales.addEncodedQuery('ritm_ssw_number=' + grCD.u_custom_req_item.number);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-12-2025 08:20 AM
This works. Thank you