---
sourceDocument: Australia ServiceNow AI Platform Administration
sourceDocumentLink: https://www.servicenow.com/docs/r/platform-administration

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia ServiceNow AI Platform Administration

ft:clusterId :

    - platadm

bundleId :

    - platadm

workflow :

    - Platform


---

# Create a UI macro for a formatter

# Create a UI macro for a formatter {#ariaid-title1}

* Release version: Australia
* 
* Updated March 12, 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

Create a UI macro to define the content that the formatter displays.

## Before you begin

This functionality requires knowledge of Jelly script.

Role required:
ui_macro_admin

## Procedure

1. Navigate to AllSystem UIUI Macros.
2. Click New.
3. Complete the form.
4. In the XML script field, enter Jelly script to define the content to be displayed by the formatter.  
   Note:  
   The UI Macro for the formatter represents a row in the UI. It must begin and end with `<TR></TR>` tags.  

   This Jelly script is reproduced below in plain text that you can copy into
   the Macro form as a basis for your macro script.  

       <?xml version="1.0" encoding="utf-8" ?>
       <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
       <button style="background: #C0C0C0; border-color: darkgrey; color: #3f464f; height:30; width:70"
       onclick="saveCustomAttachment();return false">
       <b>Attach file</b>
       </button>
       <script>
       function saveCustomAttachment(){
       var tableName = g_form.getTableName();
       var sys_id_input = gel('sysparm_item_guid') ? gel('sysparm_item_guid').value : g_form.getUniqueValue();
       if(tableName === "ni"){
       saveCatAttachment(sys_id_input, 'sc_cart_item');
       }else{
       saveAttachment('sc_req_item', sys_id_input);
       }
       }
       </script>
       </j:jelly>

5. Click Submit.
**Related concepts**   

* [Activity formatter](https://www.servicenow.com/docs/gpQSv6GKjMb10zfJV3RT2A#c_ActivityFormatter "The activity formatter provides an easy way to track items not saved with a field in the record, for example, journal fields like comments and work notes.")  
**Related tasks**   

* [Create a formatter and add it to a form](https://www.servicenow.com/docs/F6iVUu_DwA5C4dseYfvdFA "Create the formatter after creating the UI macro that defines the content.")
* [Parent breadcrumbs formatter](https://www.servicenow.com/docs/8XBxbDAwYlwJ8q1GCLGIBw#t_TaskParentBreadcrumbsFormatter "The parent breadcrumbs formatter on the Task table provides breadcrumbs that show the parent or parents of the current task. This formatter can be used also on any table that extends Task.")
* [Limit the number of activity stream entries](https://www.servicenow.com/docs/yogHyvBfCN6e1f4W5WUVEg "You can set a system property to limit the number of entries allowed in an activity stream.")
* [Override a formatter with macros](https://www.servicenow.com/docs/m_R0gDP7dKHJzYzHsA~U~Q "The system uses formatters to handle complex rendering of specific form elements.")  
**Related reference**   

* [Process flow formatter](https://www.servicenow.com/docs/T_hmj4H2aj~DR6Z47la0cA#r_ProcessFlowFormatter "The process flow formatter provides a graphical summary of the stages in a process. The formatter is typically shown at the top of forms that are part of a process.")
* [Approval summarizer formatter](https://www.servicenow.com/docs/m_KoEg0M0gWWpUnmYw4Yxw "The approval summarizer formatter creates the summary at the bottom of an approval form.")  
**Related topics**   

* [Jelly tags](https://www.servicenow.com/docs/access?context=r_JellyTags&version=australia&pubname=australia-api-reference&ft:locale=en-US)

*[\>]: and then


