Reference qualifiers for service catalog variables

Service Catalog reference variables can use advanced qualifiers to restrict the available values for choice-based variable types. The values are restricted based on the result of a script or other variables on the catalog item.

For example, you could create a Location reference variable with a reference qualifier that restricts the available location choices to those associated with groups in which the Requested For user is a member.

Note: This functionality requires knowledge of scripting.

Reference qualifier uses

The ref_qual_elements attribute can be used to specify dependent fields in the following cases:
  • Catalog Item ordering page
  • Requested Item form
  • Catalog Task form
In the JavaScript function called by the advanced reference qualifier, the current record (current) is in scope, allowing access to additional information. For example:
  • Variable information for the ordered item is available with current.variables.variablename.
  • The Request for user is available with current.cart.requested.for.

The following example defines an advanced reference qualifier for a user (sys_user) reference variable. It filters the available user records to those where Name contains the value of a variable named textmatch on the same item.

function getBlackberryUsers ( ) { var answer  = '' ; var includes  = current. variables. textmatch ; var usr  = new GlideRecord ( 'sys_user' ) ; 
  usr. addQuery ( 'name' , 'CONTAINS' ,includes ) ; 
  usr. query ( ) ; while (usr. next ( ) ) { if (answer. length > 0 ) {
      answer  += ( ',' + usr. sys_id ) ; } else { 
      answer  = '' + usr. sys_id ; } } return 'sys_idIN' + answer ; }