UI Macros

From ServiceNow Wiki
Home > Script > Server Scripting > UI Macros
Jump to: navigation, search
Note: This article applies to Fuji and earlier releases. For more current information, see UI Macros at http://docs.servicenow.com

The ServiceNow Wiki is no longer being updated. Visit http://docs.servicenow.com for the latest product documentation.

1 Overview

UI macros define modular, reusable components in the ServiceNow platform. For example, UI Macros are used to apply formatters to various forms within ServiceNow that provide additional information about the form without using a field. This functionality requires the knowledge of Jelly script.

To administer UI macros, navigate to System UI > UI Macros and define the following information:

  • 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.

2 Examples

UI Macros can invoke other UI Macros. In this example, the UI Macro invokes the ui_update_set_picker and ui_timezone_changer macros:

<?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_update_set_picker />
  <g:ui_timezone_changer /> 

UI Macros can be invoked from UI Pages:

<g:macro_invoke macro="decorate_welcome_header_stripe_left" />
Was this article helpful?
Yes, I found what I needed
No, I need more assistance