- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2015 09:32 AM
I have the following script includes, and calling it on the Asset reference field on my catalog request form.
The goal is to pull the list of assets of the 'requested_for" user. Any idea why this script does not work?
function BackfillAsset() {
var gp = "";
var a = current.variables.requested_for;
//return everything if the requested_for value is empty
if(!a)
return;
var grp = new GlideRecord('alm_asset');
grp.addQuery('assigned_to', a);
grp.query();
while(grp.next()) {
if (gp == "") {
gp = grp.sys_id;
}
else{
//build a comma separated string if there is more than one
gp = gp +','+grp.sys_id;
}
}
var returnValue = "sys_idIN"+gp ;
return returnValue;
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2015 12:38 PM
I changed this back to a reference field and added the following:
Variable attributes: ref_qual_elements=current.variables.requested_for
Ref qual: javascript: 'assigned_to='+current.variables.requested_for
Worked fine!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2015 09:47 AM
Hi Norton,
Please go through the below thread for reference.
Reference qualifier fails when a Reference type variable is changed to a Lookup Select Box
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2015 12:15 PM
I changed the variable type to lookup select box.
Lookup from table= alm_asset
Lookup field value: asset tab
Lookup field labels: asset_tag, display_name
Reference qualifier: javascript: BackfillAsset()
This brings up a list of all assets. What am I still missing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2015 12:38 PM
I changed this back to a reference field and added the following:
Variable attributes: ref_qual_elements=current.variables.requested_for
Ref qual: javascript: 'assigned_to='+current.variables.requested_for
Worked fine!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2020 02:22 PM
Awesome work
Was super helpful. I just dont like how its in a selection drop down, but I'm sure I can figure that out soon! (probably because its a reference list)
Have you done that?
If others are interested here's how it looks like (a picture is worth a million words :))