accessing variable through dot walking
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2016 04:08 AM
I have reference to "sc_req_item" called request_item on another table. I am trying to dot walk to get one of the variable and not successful. Tried to query the table using "request_item.variables.temp_var" but don't seem to get the value.
gr.addQuery('request_item.variables.temp_var', 'Test');
Is there something different to get the values for variables?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2016 05:39 AM
I afraid its not possible to filter through addQuery() function.
Request item variable values are stored in "sc_item_option_mtom" table and these values are related to sc_req_item table through sc_item_option table. Since, the relationship between request item table to these tables are one to many relationship and reference column is stored in other side of request item table, you can't use "addQuery" function on sc_req_item table to filter the records.
One solution is, while iterating values, you can filter it.
var gr = new GlideRecord('sc_req_item');
gr.query();
gs.addInfoMessage(gr.getRowCount());
while(gr.next())
{
if(gr.variables.testvariable1 == "somevalue" )
{
}
}
Or else, if you want only certain few fields from sc_req_item table, you can use sc_item_option_mtom table as base table to get the request numbers.