UI Macros

UI macros are discrete scripted components administrators can add to the user interface.

UI macros are typically controls that provide inputs or information not provided by existing field types. By default, the system provides UI macros for a variety of user interface elements such as:
  • All formatters
  • The Service Catalog cart
  • The action icons next to fields
  • The action icons on forms and lists
  • The widgets of a content management system
  • The Orchestration activity designer

Administrators can create their own UI macros to provide custom controls or interfaces. Creating UI macros requires knowledge of Jelly script. Review the existing UI macros for examples and suggested approaches. Those who want to build custom interfaces with JavaScript technologies should consider Service Portal as an alternative.

Calling UI macros

Administrators can call UI macros from certain record types associated with the user interface.

Table 1. Calling UI Macros by record type
Record type Example
Dictionary attribute

Display an icon for a reference field:

ref_contributions=ui_macro_name
UI page

Display something on a UI page:

<g:macro_invoke macro="ui_macro_name" />
UI macro

Call a UI macro from another UI macro:

<?xml version= "1.0" encoding="utf-8"&nbsp;?>
<j:jelly trim= "false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
  <g:ui_macro_name />
  <g:ui_macro_name_2 />
</j:jelly>

UI macro form

Each UI macro record consists of a name and an XML document written in Jelly code.

Table 2. UI macro fields
Field Description
Name A unique and descriptive name for this macro.
Active Select the check box to render the element as defined. Clear the check box to disable the element without deleting the code. For example, the email_reply macro is inactive by default.
Description Describe the purpose of the macro and parameters passed to it.
XML Jelly script that defines the macro.