- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2016 10:04 PM
Hi Guys,
I need to do a dot-walking within the below GlideRecord, I know I need to use getElementValue() but I have no idea how to use it. My requirement is in addition to the below condition, I also want to have the below query added:
sysapproval.cat_item==gs.getProperty('snc.eprocurement.catalog_item')
The below query runs for all catalog items but I only wanted to run for one specific catalog item:
var gr = new GlideRecord('sysapproval_approver');
gr.addEncodedQuery('sys_created_onRELATIVEGE@dayofweek@ago@4^sys_created_onRELATIVELT@dayofweek@ago@3^state=requested^source_table=sc_req_item');
gr.query();
while(gr.next()){
gs.eventQueue("eproc_approval.reminders_3days", gr, gs.getUserID(), gs.getUserName());
}
Any idea?
Mussie
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2016 08:28 PM
Oh, the issue is that you can't dot-walk to cat_item (on the sc_req_item table) from the sysapproval field (which points to the task table).
Try one of these.
var query = 'sys_created_onRELATIVEGE@dayofweek@ago@4^sys_created_onRELATIVELT@dayofweek@ago@3^state=requested^source_table=sc_req_item';
var appr = new GlideRecord('sysapproval_approver');
appr.addEncodedQuery(query);
appr.query();
while (appr.next()){
if (appr.getElement('sysapproval.cat_item') == gs.getProperty('snc.eprocurement.catalog_item'))
gs.eventQueue("eproc_approval.reminders_3days", appr, gs.getUserID(), gs.getUserName());
}
var query = 'sys_created_onRELATIVEGE@dayofweek@ago@4^sys_created_onRELATIVELT@dayofweek@ago@3^state=requested^source_table=sc_req_item';
var appr = new GlideRecord('sysapproval_approver');
appr.addEncodedQuery(query);
appr.query();
while (appr.next()){
var ritm = new GlideRecord('sc_req_item');
if (ritm.get(appr.sysapproval)) {
if (ritm.cat_item == gs.getProperty('snc.eprocurement.catalog_item'))
gs.eventQueue("eproc_approval.reminders_3days", appr, gs.getUserID(), gs.getUserName());
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2016 10:47 PM
only we can use that table name field in add query gr.addQuerty('glide_recird_field_name', 'value'); // this field_name refering to only that table...
so, the best option is to use the view itself
Hope you got it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2016 07:42 PM
var query = 'sys_created_onRELATIVEGE@dayofweek@ago@4^sys_created_onRELATIVELT@dayofweek@ago@3^state=requested^source_table=sc_req_item';
query += '^sysapproval.cat_item=' + gs.getProperty('snc.eprocurement.catalog_item');
var gr = new GlideRecord('sysapproval_approver');
gr.addEncodedQuery(query);
gr.query();
while (gr.next()){
gs.eventQueue("eproc_approval.reminders_3days", gr, gs.getUserID(), gs.getUserName());
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2016 08:28 PM
Oh, the issue is that you can't dot-walk to cat_item (on the sc_req_item table) from the sysapproval field (which points to the task table).
Try one of these.
var query = 'sys_created_onRELATIVEGE@dayofweek@ago@4^sys_created_onRELATIVELT@dayofweek@ago@3^state=requested^source_table=sc_req_item';
var appr = new GlideRecord('sysapproval_approver');
appr.addEncodedQuery(query);
appr.query();
while (appr.next()){
if (appr.getElement('sysapproval.cat_item') == gs.getProperty('snc.eprocurement.catalog_item'))
gs.eventQueue("eproc_approval.reminders_3days", appr, gs.getUserID(), gs.getUserName());
}
var query = 'sys_created_onRELATIVEGE@dayofweek@ago@4^sys_created_onRELATIVELT@dayofweek@ago@3^state=requested^source_table=sc_req_item';
var appr = new GlideRecord('sysapproval_approver');
appr.addEncodedQuery(query);
appr.query();
while (appr.next()){
var ritm = new GlideRecord('sc_req_item');
if (ritm.get(appr.sysapproval)) {
if (ritm.cat_item == gs.getProperty('snc.eprocurement.catalog_item'))
gs.eventQueue("eproc_approval.reminders_3days", appr, gs.getUserID(), gs.getUserName());
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2016 09:08 PM
Thanks Geoff, the first one worked.