Passing variable value to script includes in a reference qualifier
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2019 07:21 PM
Hi All,
I have a rather complex form that uses a couple of variable sets as well on form variables. What I'm trying to do is pass the value from a variable in variable to the reference qualifier of the second variable set.
To put it in context I'm trying to pass the value of a "platform" e.g. IIS, I H S, Oracle etc.... through to a Multi Row Variable Set that references the CMDB and filters it accordingly so for IIS will only show windows servers.
So in the advanced reference qualifier of the MRVS I have:
javascript: new SSLCertUtils().filterNodesOnPlatform(current.platform);
The script includes looks like:
filterNodesOnPlatform: function (platform){
var query;
switch (platform){
case "web_iis":
query = 'operational_status=1^sys_class_name=cmdb_ci_win_server^EQ';
break;
case "web_ihs":
query = 'operational_status=1^sys_class_name=cmdb_ci_unix_server^EQ';
break;
default:
query = 'operational_status=1;
}
return query;
},
When I output the value of 'platform' in the script above i get 'undefined'. I have tried all sorts of combinations and nothing seems to work.
When i just pass current and output it i get [object GlideRecord] but i can't find anyway to use this to look up the variable value.
Can someone help me out here.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2019 10:01 PM
Just to provide an update on this. After some digging a colleague found this on the ServiceNow Docs site.
NOTE:
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.
So basically what i'm trying to do wont work and will either need to redesign the form to include the platform in the MRVS or come up with some other workaround for it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2020 12:24 PM
hello I have a similar requirement did you get to something with this ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2020 12:40 AM
Hi Evan,
I saw a workaround of what you're looking for.
https://jace.pro/post/2019-11-19-setting-vars-in-a-mrvs-from-outside/
Hope it helps