- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2023 09:30 AM
Hi,
I'm trying to return a list of variables to a list collector based on a selection made in a reference field to the sc_cat_item table. I.e., the requestor selects the catalogue item and the 'variables to be removed' variable only displays the variables attached to that item. See screenshot below.
I've updated the reference qualifier on the list collector to -
javascript: 'sys_idIN' + new GetCatItemDetails().getVariables(current.variables.catalogue_item_to_be_updated);
This is calling a script include function -
getVariables: function(catItem) {
var vars_array = [];
var getVars = new GlideRecord('item_option_new');
getVars.addQuery('cat_item', catItem);
getVars.query();
while (getVars.next()) {
var varsSysId = getVars.getValue('question');
vars_array.push(varsSysId);
}
return vars_array;
},
Can anyone see where I am going wrong as the variable always comes back with 'No matches found'.
Steven
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2023 06:45 AM - edited 03-22-2023 06:47 AM
Got it!
Please do this in reference qualifier, it will work 100%:
javascript: 'cat_item=' + current.variables.your_term_variable_name_here;
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2023 06:45 AM - edited 03-22-2023 06:47 AM
Got it!
Please do this in reference qualifier, it will work 100%:
javascript: 'cat_item=' + current.variables.your_term_variable_name_here;
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2023 06:52 AM
Thanks for all your help. That has worked spot on :).
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2023 02:05 AM
Hi,
Could you try the below code :-
getVariables: function(catItem) {
var vars_array = [];
var getVars = new GlideRecord('item_option_new');
getVars.addQuery('cat_item', catItem);
getVars.query();
while (getVars.next()) {
var varsSysId = getVars.getValue('sys_id');
vars_array.push(varsSysId);
}
return String(vars_array);
},
Hope this helps.
Regards,
Dhruv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2023 02:27 AM
Hi,
Thanks for the assistance. Unfortunately i'm getting the same issue. Might just add a multiline string variable and let them enter the questions.
Thanks.