- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2018 06:55 PM
How to get all the catalog item by using Business Rule or by using client script from Record Producer.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2018 07:19 PM
What is the Business Requirement?
You can get them via a report:
https://docs.servicenow.com/bundle/istanbul-performance-analytics-and-reporting/page/use/reporting/task/create-list-report-with-variable-columns-rows_RB.html
Or a script like below will output all variable values:
var grRequestedItem = new GlideRecord('sc_req_item');
grRequestedItem.setLimit(10);
grRequestedItem.query();
while (grRequestedItem.next()) {
gs.addInfoMessage('Variables for ' + grRequestedItem.getDisplayValue());
for (var prop in grRequestedItem.variables) {
if (grRequestedItem.variables.hasOwnProperty(prop) ){
var variable = grRequestedItem.variables[prop];
gs.addInfoMessage(prop + ':' + variable);
}
}
}
Output
Variables for RITM0010006 |
acrobat:false |
photoshop:false |
Additional_software_requirements: |
Variables for RITM0010007 |
new_email:jo.asd@asdas.com |
Variables for RITM0010008 |
ergonomic_office: |
Variables for RITM0010009 |
acrobat:true |
photoshop:true |
Additional_software_requirements:1 |
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2018 07:19 PM
What is the Business Requirement?
You can get them via a report:
https://docs.servicenow.com/bundle/istanbul-performance-analytics-and-reporting/page/use/reporting/task/create-list-report-with-variable-columns-rows_RB.html
Or a script like below will output all variable values:
var grRequestedItem = new GlideRecord('sc_req_item');
grRequestedItem.setLimit(10);
grRequestedItem.query();
while (grRequestedItem.next()) {
gs.addInfoMessage('Variables for ' + grRequestedItem.getDisplayValue());
for (var prop in grRequestedItem.variables) {
if (grRequestedItem.variables.hasOwnProperty(prop) ){
var variable = grRequestedItem.variables[prop];
gs.addInfoMessage(prop + ':' + variable);
}
}
}
Output
Variables for RITM0010006 |
acrobat:false |
photoshop:false |
Additional_software_requirements: |
Variables for RITM0010007 |
new_email:jo.asd@asdas.com |
Variables for RITM0010008 |
ergonomic_office: |
Variables for RITM0010009 |
acrobat:true |
photoshop:true |
Additional_software_requirements:1 |
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2020 09:12 AM
Hi
How do you modify your script to only show the variables from a specific RITM?
Thanks!
Harriet

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2021 05:37 AM
Hi Harriet,
You can change the query of the script and add your specific RITM sys_id.
var cat_item = '99e872e6db1dbe447fc2f7adae9619d8';
var catVarValues = '';
var grRequestedItem = new GlideRecord('sc_req_item');
// grRequestedItem.setLimit(10);
// grRequestedItem.addEncodedQuery('numberSTARTSWITHRITM0028764');
grRequestedItem.query();
if (grRequestedItem.get(cat_item)) {
// gs.addInfoMessage('Variables for ' + grRequestedItem.getDisplayValue());
// gs.info(JSON.stringify(grRequestedItem.variables, null, 4));
for (var prop in grRequestedItem.variables) {
if (grRequestedItem.variables.hasOwnProperty(prop)) {
var variable = grRequestedItem.variables[prop];
catVarValues = catVarValues + prop + ':' + variable + '\n';
}
}
}
gs.info('Summary: \n' + catVarValues);
Hope this works.
Regards,
Swarnadeep Nandy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2021 07:46 AM
Thank you,