- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2018 09:59 PM
I'm running a background script where I want to compare some values from different tables before making any changes. I'm able to print values from one table but not from the other. This is my background script
var gr = new GlideRecord('sc_task');
gr.addQuery('short_description', "VMO signature attachment");
gr.query();
while(gr.next()){
var br = new GlideRecord('sc_item_option_mtom');
br.addEncodedQuery('sc_item_option.item_option_new.cat_item.name=Request a new service^sc_item_option.item_option_new.question_text=VMO Approves Date^sc_item_option.value!=NULL'); //vmo approves date
br.addQuery('request_item', gr.request_item);
br.query();
gs.print("Row count: " + br.getRowCount() + ">>>>>" + "RITM Number: " + gr.request_item.getDisplayValue());
if(gr.closed_at != br.sc_item_option.value){
/*EVERYTHING I TRY TO PRINT FROM "br" query is printed as undefined (TRY log below)*/
//gs.print("RITM Number: " + gr.request_item.getDisplayValue() + ">>>>>>" + "Task closed at: " + gr.closed_at + ">>>>>" + "VMO Approves Date Stamp: " + br.sc_item_option.value);
}
}
Solved! Go to Solution.
- Labels:
-
Best Practices

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2018 10:05 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2018 10:05 PM
Hi,
Include br.next(); after br.query();
-Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2018 10:14 PM
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2018 10:25 PM
You are very welcome. Thanks for participating in the community!
-Pradeep Sharma