Service Catalog: Showing Variable Set Options under Auto-Populate's Dependent Question

Tristan Elmore
Tera Expert

Trying to figure out how to show the variables within a variable set under the auto-populate tab for a catalog item variable.

TristanElmore_0-1696530037433.png

I checked the definitions on the dictionary entry for the dependent question field, which led me to the SNCCatalogUtil script include.

TristanElmore_1-1696530738280.png

 

TristanElmore_2-1696530785749.png

 


It makes sense why I can't see any of the variable set reference fields because a variable can only belong to either a catalog item or a variable set, but not both. The script include checks whether the variable record is on a catalog item or not (i.e., on a variable set) and then filters the variable list down.

Ideally, at least from my perspective, that dynamic reference qualifier would look at the variables specific to the catalog item—as well as include variables on any variable sets on the catalog item as options for the dependent question. Though the latter doesn't seem to be the case on our instance. We're currently on Utah patch 4 hotfix 2b.

I cannot think of a way to readily implement that as of right now, nor do I know if the auto-populate functionality would actually work if I could get that dependent question to show the variable set variables there.


Does anyone have any insight here?

1 ACCEPTED SOLUTION

Looking at your SI function more closely, and the updated one.  I can see they fully intended for this to work, but a simple logic error is preventing it.  You should be able to fix this (until you can upgrade) by copying the SI and updating the function (then calling your new SI from the reference qualifier).  My reference qualifier is exactly the same as yours.

 

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';
	},

I can also confirm that this is not fixed as of Utah patch 7.

 

 

View solution in original post

5 REPLIES 5

After digging into this further, I've realized there are a couple of scenarios that are not covered in Vancouver or this enhancement, and have posted a more encompassing solution in this article:

https://www.servicenow.com/community/itsm-articles/using-the-variable-auto-populate-feature-with-var...