How do I access the sc_cat_item sys_id from within a variable that is in a variable set from a business rule and reference_qual?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2012 09:51 AM
Not sure if this is possible but this is what I am attempting to do:
My variable is a Lookup Mulitple Choice referencing a new table (u_llb_app_functional_access) I've created. The variable is in a variable set.
One of the fields (u_application_name) in the table is a reference field to sc_cat_item name.
I need to filter the records to display on the form only those record that match the catalog item I am in.
When the user selects the catalog item 'Sevice Now' and the form is displayed
The variable should only list those records that match 'Service Now' records in this table.
I thought I could accomplish this will a business rule as noted below - but the includes statement below is not working and the query brings back null.
function getSoftwareFunctionalAccess() {
var answer = ' ';
var includes = current.sc_cat_item.sys_id;
var usr = new GlideRecord('u_llb_app_functional_access');
usr.addQuery('u_application_name','=',includes);
usr.query();
while (usr.next()) {
if (answer.length > 0) {
answer += (',' + usr.sys_id);
}
else {
answer = usr.sys_id;
}
}
return 'sys_idIN' + answer;
}
Bottom line: I need to obtain the current.sys_id of the catalog item to enable filtering of the variables list. We've only recently implemented Service-now so my knowledge is very limited. Is this the appropriate implementation of Business Rules or is there antoher feature within Service-Now I should be using?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2012 08:42 AM
Changing the includes statement to the following gets me the sys_id of the catalog item I am in:
var includes = current.cat_item;