Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
function onLoad() {
var mgr = g_service_catalog.parent.getValue('v_manager'); //if using this script onLoad of the MRVS
//var mgr = newValue; // if using this script onChange of the Catalog Item variable
var filterString = 'active=true^manager=' + mgr; //Reference qualifier following the 'javascript:'
//alternate method for Service Portal only
// if (window == null){ //Service Portal method
// var setfilter = g_list.get('v_employee');
// setfilter.setQuery(filterString);
// } else { //native UI method
var ga = new GlideAjax('refQualUtils'); //Client callable Script Include Name
ga.addParam('sysparm_name', 'setSysProp'); //Function in Script Include
ga.addParam('sysparm_sys_prop_name', 'sr.mrvs.ref_qual.emp'); //System Property Name used in MRVS variable Reference qualifier
ga.addParam('sysparm_sys_prop_value', filterString);
ga.getXML(getResponse);

function getResponse(response) { //to avoid Service Portal 'There is a JavaScript error in your browser console'
var answer = response.responseXML.documentElement.getAttribute("answer");
}
//}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var refQualUtils = Class.create();
refQualUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {

setSysProp: function(){
var propertyName = this.getParameter('sysparm_sys_prop_name');
var propertyValue = this.getParameter('sysparm_sys_prop_value');
var property = gs.getProperty(propertyName);
gs.setProperty(propertyName, propertyValue);
return;
},

type: 'refQualUtils'
});

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
*** This solution uses g_list, so it works in Service Portal (and I assume ESC) only, not the native UI / Service Catalog interface ***<br>
Developed in collaboration with Chris Perry
On a reference variable in a multi-row variable set, sometimes you want the reference qualifier to include the value of a variable that is part of the Catalog Item, not within the MRVS.

In this simplified example, I have a Manager (v_manager) reference variable (sys_user table) that belongs to the Catalog Item. In the MRVS, I have an Employee (v_employee) reference variable (sys_user table). I only want to be able to select user records that are active, and the Manager is the user I selected on the Catalog Item variable.

On a reference variable in a multi-row variable set, sometimes you want the reference qualifier to include the value of a variable that is part of the Catalog Item, not within the MRVS
1) Set the advanced reference qualifier on the MRVS variable to
javascript: gs.getProperty("sr.mrvs.ref_qual.emp");
using a System Property Name of your choice

When using this script that applies to the Variable set, not the Catalog Item, leave the Reference qualifier field on the MRVS variable empty
2) Use the included onLoad Catalog Client Script that applies to the Variable set, or you can also use this onChange of the Catalog Item variable in a script that applies to the Catalog Item.

In this simplified example, I have a Manager (v_manager) reference variable (sys_user table) that belongs to the Catalog Item. In the MRVS, I have an Employee (v_employee) reference variable (sys_user table). I only want to be able to select user records that are active, and the Manager is the user I selected on the Catalog Item variable.
3) Add the included Client callable Script Include for the Catalog Client Script to call via GlideAjax. This Script Include uses parameters for the System Property Name and Value, so it can be re-used in every instance of this solution.

This solution works in both the Native UI and Service Portal. The script contains an alternate Service Portal only approach in the commented if block that can be used in conjunction with the native UI approach in the else block. This alternate Service Portal solution was developed in collaboration with Chris Perry.