
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 07:39 AM
I have a service catalog where I have two fields :
1. Contract Number - Single line text (independent variable)
2. Assets (Multi row variable set having one variable of type reference to asset)
Now, when I enter Contract Number, I should see only those assets which are associated in that contract.
I wrote a script include :
getAssetsForCustomer: function(contractNumber) {
gs.info('Checkpoint 1 '+contractNumber);
if (contractNumber == '') {
gs.info('Checkpoint 2 '+contractNumber);
return '';
} else {
gs.info('Checkpoint 3 '+contractNumber);
var contractId = '';
var grContract = new GlideRecord("ast_contract");
grContract.addQuery("number", contractNumber);
grContract.query();
if (grContract.next()) {
contractId = grContract.sys_id;
}
if(contractId == ''){
gs.info('Checkpoint - Empty contractId');
return '';
}
var AssetIDs = [];
var gr = new GlideRecord("clm_m2m_contract_asset");
gr.addEncodedQuery("contract="+contractId);
gr.query();
while (gr.next()) {
if(AssetIDs.indexOf(gr.asset.toString()) == -1){
AssetIDs.push(gr.asset.toString());
}
}
if(AssetIDs.length == 0){
return '';
}else{
gs.info('Checkpoint 4'+AssetIDs.join(','));
return 'sys_idIN'+AssetIDs.join(',');
}
}
},
I am calling this function in reference qualifier as below :
javascript:new global.TestUtils().getAssetsForCustomer(current.variables.contract_number);
In the logs I am getting the parameter as undefined(Checkpoint 1 and Checkpoint 2) i.e. current.variables.contract_number is undefined
Could you please help me pass a catalog variable into this function?
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 08:02 AM
This is not supported
Variables that are not included in a multi-row variable set cannot be used in dependent reference qualifiers for variables in the multi-row variable set.
Similarly, the variables included in the multi-row variable set cannot be used in dependent reference qualifiers for variables that are not in the multi-row variable set.
For a reference qualifier, the current row is the one that is being edited.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 07:47 AM
Have you added the "ref_qual_elements"-attribute to your variable that has the Reference Qualifier?
Like so:
ref_qual_elements=contract_number

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 08:08 AM
It didn't work.
However, I just want to know if there is any way to access this ref_qual_elements value in script include?
Because I already have a script include with parameter, but it is not fetching any value from the catalog.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 07:47 AM
I think MRVS is very limited on the Reference Qualifiers that can be used on it, this was an issue from the previous 3rd party table variables as well.
Which version of ServiceNow are you on?
This community article has a wealth of information on MRVS: https://community.servicenow.com/community?id=community_blog&sys_id=15d6c8811b328010a59033f2cd4bcbf9
I see in the chart that Advanced Reference Qualifiers do not work in Platform for Lookup questions is fixed in Orlando.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 08:02 AM
This is not supported
Variables that are not included in a multi-row variable set cannot be used in dependent reference qualifiers for variables in the multi-row variable set.
Similarly, the variables included in the multi-row variable set cannot be used in dependent reference qualifiers for variables that are not in the multi-row variable set.
For a reference qualifier, the current row is the one that is being edited.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader