Setting variables as the default values for custom fields

When you enter a variable or an expression as the default value and select the Is Expression check box at the same time, the tailoring values for custom fields are automatically filled in the user interface. This also applies to CI information retrieval and fulfillment. If you use variables as the default value for the item title and description fields, the title of the items are automatically filled when you submit these items in your cart.

This enhancement supports the following content:

  • Traditional expressions in Service Manager applications, such as name in $lo.operator
  • Jscall syntax to return advanced query results, such as the location of a logged in user. As long as a predefined JavaScript expression can return a query result, it can be set as a default value in custom fields.

    Note To use jscall, make sure you define the Javascript function in the Script library first.

  • Logical name

    If you are setting default value for a lookup field which will retrieve a logical name value, you must use XML string to return the correct value.

    Note There are some restriction rules for the XML string:

    • You cannot change the label and value attributes in the XML string and the format of the string must follow this example:

      <root>< label >CHAR-adv-asi-desk-102</label><value>CI1000102< /value ></root>

      In this example, the label attribute returns the value of display name and the value attribute returns the value of CI number.

    • If you add more than one child to the XML string, only the first child of the XML string is supported. For example, if you write a string as:

      <root>< label >CHAR-adv-asi-desk-102</label><value>CI1000102< /value ><label>CHAR-adv-asi-desk-101</label><value>CI1000101</value></root>

      Only the display name of CHAR-adv-asi-desk-102 and value of CI1000102 is supported by the system.

  • Any RAD expressions
  • Text, Multiple Text, Checkbox, and Pick List default value types. Different value types support different data types, as shown in the following table.

    Default value types

    Supported data type

    Examples

    Text/MultiText

    Character, Logical, Number, Date, and Time

    • $lo.operator
    • jscall("srcLib.getDefaultName")
    • "default value:"+$G.my.currency

    Checkbox

    Logical

    • "falcon"=name in $lo.operator
    • $G.my.currency="USD"
    • jscall("srcLib.getDefaultCheckBox")

    Note The expression for Checkbox only returns the values “true” and “false”.

    Pick List

    Character, Number, Date, and Time

    • jscall("srcLib.getNumber") 
    • jscall("srcLib.getNumber")+1
  • Pre-defined variables in Service Request Catalog

    Default value

    Definition

    Content displayed

    $src.cart.item.name

    The name of the cart item

    • The name of the item or bundle, if there is only one item or bundle in the cart
    • Multiple cart items request, if there are mutiple items in the cart

    $src.cart.item.name.list

    The list of the cart item

    • The name of the item or bundle, if there is only one item or bundle in the cart
    • A name list for all items, if there are mutiple items in the cart

    $src.cart.size

    The size of the cart item

    The number of items in the cart

Note When your customization is complete, you must restart the Service Request Catalog web application server (for example, Tomcat) for the changes to take effect.