- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-12-2023 04:00 PM
I have a variable called requested_for_email that I'm trying to auto populate depending on a variable called requested_for which references sys_user. I understand that I can simply use the Auto-populate tab but since requested_for is part of a variable set it is not letting me select it. Is there a way around this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2023 03:29 AM
Variables in a single row variable set are available in the Dependent question field as of Vancouver (patch 2 or maybe earlier). To get this 'fixed' functionality before upgrading, make a copy of the Script Include named SNCCatalogUtil and then change the Reference qual on the Dependent question Dictionary Entry with the updated name.
Inside the new version of the SI you need to add the _getSingleRowVariableSetIdList function, and modify the getDynamicValueFieldRefQual function. Here are those sections from my Vancouver PDI:
_getSingleRowVariableSetIdList: function(catItemId) {
var srvsIdList = [];
var gr = new GlideRecord('io_set_item');
gr.addQuery('sc_cat_item', catItemId);
gr.addQuery('variable_set.type', 'one_to_one');
gr.query();
while (gr.next())
srvsIdList.push(gr.getValue('variable_set'));
return srvsIdList;
},
getDynamicValueFieldRefQual: function(catItemId, variableSetId, variableId) {
if (catItemId) {
var srvsIdList = this._getSingleRowVariableSetIdList(catItemId);
if (srvsIdList.length != 0)
return 'cat_item='+catItemId+'^ORvariable_setIN'+(srvsIdList)+'^sys_id!='+variableId+'^typeIN8,31';
else
return 'cat_item='+catItemId+'^sys_id!='+variableId+'^typeIN8,31';
}
else if (variableSetId)
return 'typeIN8,31^variable_set='+variableSetId+'^sys_id!='+variableId;
return 'cat_item=-1';
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2023 03:29 AM
Variables in a single row variable set are available in the Dependent question field as of Vancouver (patch 2 or maybe earlier). To get this 'fixed' functionality before upgrading, make a copy of the Script Include named SNCCatalogUtil and then change the Reference qual on the Dependent question Dictionary Entry with the updated name.
Inside the new version of the SI you need to add the _getSingleRowVariableSetIdList function, and modify the getDynamicValueFieldRefQual function. Here are those sections from my Vancouver PDI:
_getSingleRowVariableSetIdList: function(catItemId) {
var srvsIdList = [];
var gr = new GlideRecord('io_set_item');
gr.addQuery('sc_cat_item', catItemId);
gr.addQuery('variable_set.type', 'one_to_one');
gr.query();
while (gr.next())
srvsIdList.push(gr.getValue('variable_set'));
return srvsIdList;
},
getDynamicValueFieldRefQual: function(catItemId, variableSetId, variableId) {
if (catItemId) {
var srvsIdList = this._getSingleRowVariableSetIdList(catItemId);
if (srvsIdList.length != 0)
return 'cat_item='+catItemId+'^ORvariable_setIN'+(srvsIdList)+'^sys_id!='+variableId+'^typeIN8,31';
else
return 'cat_item='+catItemId+'^sys_id!='+variableId+'^typeIN8,31';
}
else if (variableSetId)
return 'typeIN8,31^variable_set='+variableSetId+'^sys_id!='+variableId;
return 'cat_item=-1';
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2023 03:43 AM
try to use onChange client script + GlideAjax then
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader