You are currently viewing All About ServiceNow Service Catalog Variables?

All About ServiceNow Service Catalog Variables?

  • Service catalog plays a vital role in any organization.
  • It nicely demonstrate the services and faculties available for the users/customers & employees of organization.
  • We have o make sure to design the services forms or catalog items in such a way that it provide easy information and capture enough details from users to process the service request.
  • This getting and setting of information is done by using variables.

What are Service Catalog variables?

  • Service catalog variables records & pass on customer choices or details while ordering a catalog item. 
  • These pieces of information is critical for the service provider to provide exactly what is needed by user.
  • Catalog variables defines the structure of a catalog item form that is displayed to the customer.
  • Below screenshot displays Install Software catalog item & it has two variables asking for information from users

What is the use of variables in service catalog?

Catalog variables are used to :-

  • Display any information bout services
  • Get any information or input from users
  • To do certain calculations based on other parameters and variables
  • Give direction to users
  • Used by delivery team to provide services

What all types of variables are available in Service Catalog?

  • These are various types of variables like we have fields available in servicenow tables.
  • Few common types are single line text, multiline text , reference, date variables etc.
  • List of all variable types – Click Here

Where the catalog variables stored in ServiceNow?

All the values of variables stored in Variable Ownership [sc_item_option_mtom] table.

Script To access catalog item variables?

Below script is displaying the list of variables & its values corresponding to a particular requested item.

var requestSys_id='5b26e3dd073461105ff1f9fc7c1ed06d';
var item = new GlideRecord("sc_req_item");  
item.addQuery("sys_id", requestSys_id);   
item.query();   
if (item.next()) 
{     
var var_own = new GlideRecord('sc_item_option_mtom');     
var_own.addQuery('request_item', item.sys_id);         
var_own.orderBy('sc_item_option.item_option_new.order');     
var_own.query();     
while (var_own.next()){             
gs.print(var_own.sc_item_option.item_option_new.question_text + ": " + eval('item.variable_pool.'+var_own.sc_item_option.item_option_new.name+'.getDisplayValue()') + "\n");      
 }     
}
Output

Leave a Reply