Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.
  • Madrid
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store

Scriptable service catalog variables

Log in to subscribe to topics and get notified when content changes.

Scriptable service catalog variables

You can use scripting to reference any variables used by a request item from any table.

An example of a variable reference follows.
Where current refers to the current record, and <variable_name> is the name of your variable.
Note: In order to reference a variable from JavaScript, it must have a name.

Print a variable

var original = current.variables.original_number;

Set a variable = "Auto-Generated:" + current.variables.asset_tag;

Create an inventory item with fields set from variables


function doCreation ( ) { 
var create = current.variables.create_item; 
if (create == 'true') { // we want to create an asset 
  var computer = new GlideRecord('cmdb_ci_computer');
  computer.asset_tag = current.variables.asset_tag;
  computer.serial_number = current.variables.serial_number; =;
  computer.manufacturer =;
  computer.insert(); } }

Notes and limitations

  1. You can only set a variable in a before business rule. Variables set in an after rule are not written to the database.
  2. There is nothing in place to prevent namespace collision with variables. Creating two variables named computer_speed would result in only one of them showing up; the second one would overwrite the first one.
  3. Date/time variables use the same time zone formatting and storage rules as all other dates in the system. They are stored internally in GMT, but translated into the user's local time zone and format for display.