logo

NJP

Helpful Text on Forms using UI Macros

Import · Nov 30, 2011 · article

<?xml version="1.0" encoding="utf-8" ?>Note: Approvals are subject to regulatory audits.

/j:jelly

The result should look something like this:

image

Make a note of the UI Macro name. You'll need it in a bit. Also note that I intentionally named it more like a variable (no spaces).

"Hey Chuck, that message is always going to be in English. My organization requires multilingual capabilities." Never fear, just go to System UI> Messages and create a new record with a unique key (ex: approval_audit_message), select the language, and put in the text.

image

Next, go back to the UI Macro and replace the 'hard coded' text message in the UI macro with

${gs.getMessage('approval_audit_message')}

. Like this:

<?xml version="1.0" encoding="utf-8" ?>${gs.getMessage('approval_audit_message')}

/j:jelly

Add more entries in the Message list with the same key for the other languages you support.Step 2, place your new UI macro on the form. If you try going to the form and personalizing the form layout in the traditional way (Right click, Personalize> Form Layout), you won't see anything representing your UI Macro. Here's how to place your custom UI Macro on the form:

  1. Navigate to System UI> Form Sections
  2. Locate your view in the list (filtering by table helps, ex: sysapproval_approver)
  3. Open the record
  4. In the Section Elements related list, create a new entry with the New button
  5. Fill in the form
  6. * Element: ApprovalMessage.xml
    • Position: 0
    • Type: formatter
  7. Submit
  8. Update the Position on the related list to place the field relative to the other fields (I quickly renumber these using list edit.)

image

When you go back to Personalize> Form Layout screen, your custom formatter is at the top of the list. Reposition it as necessary.

image

Caveat: If you remove it (placing it from the Selected column to Available column) and save your new layout, you'll have to re-add it via the Forms Sections again.Have fun providing your users with more interesting and complex forms using UI Macros!

References:

Update (2017-07-12): While the functionality may be similar to annotations, these are persistent. With annotations, users can turn off annotations and the helpful text will no longer appear. Using this method, the users cannot toggle it on/off like annotations.

View original source

https://www.servicenow.com/community/in-other-news/helpful-text-on-forms-using-ui-macros/ba-p/2281511