How to Create and Show/Hide Annotations in a Form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2025 11:48 PM
𝐇𝐨𝐰 𝐭𝐨 𝐂𝐫𝐞𝐚𝐭𝐞 𝐚𝐧𝐝 𝐒𝐡𝐨𝐰/𝐇𝐢𝐝𝐞 𝐀𝐧𝐧𝐨𝐭𝐚𝐭𝐢𝐨𝐧𝐬 𝐢𝐧 𝐚 𝐅𝐨𝐫𝐦
Annotations are essential in ServiceNow forms as they enhance user experience, reduce errors, and provide additional support, making processes more intuitive and efficient.
How to create an Annotation
Open the 'Personalize Form Layout' page in the form > Locate the field type '*Annotation' > Select it for the form view.
Annotation Details:
Form Annotation Type –> table 'sys_ui_annotation_type' – where you can define the <style> for your HTML annotation text:
To add the content to the text, we will create a Message in the 'sys_ui_message' table in HTML format:
After selecting the Style and creating the Message, we can now create the Annotation:
View the Annotation in the Form:
How to show/hide an annotation through a Client Script
I added a new variable for the demonstration. If the 'Select to hide' checkbox is selected, I want the annotation to be hidden.
To do this, we need to reconfigure the annotation:
Open the 'Personalize Form Layout' page in the form > Locate the previously created annotation.
Add an id attribute as a unique identifier for the text so we can reference it in the client script:
New Client Script:
Note: The 'Isolate script' field must be set to false, i.e., not selected.
View of the result in the form:
- 1,939 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi @ArTex ,
Does annotation record get captured in update set ???
and if not then do we have move across instances with xml record ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @tushar_ghadage ,
Plese check the response below.
- sys_ui_annotation is considered a data/content table, not a configuration table like Business Rules or Client Scripts.
- When you create an annotation via Configure > Form Layout, the layout change is captured (the fact that "an annotation" should be there), but the actual content of the annotation record itself is often left behind.
- On the Source Instance, navigate to the Annotations [sys_ui_annotation] list.
- Filter for your specific records.
- Right-click any column header and select Export > XML (This Record) or XML (All).
- On the Target Instance, go to any list view (e.g., sys_user_group), right-click a header, and select Import XML. Upload your file.
- Make sure your desired Update Set is active.
- Navigate to System Definition > Scripts - Background.
- Run the following script (replace 'SYS_ID' with your annotation's ID)
var gr = new GlideRecord('sys_ui_annotation');
if (gr.get('YOUR_ANNOTATION_SYS_ID')) {
var um = new GlideUpdateManager2();
um.saveRecord(gr);
gs.print('Record captured in Update Set');
}Option C: "Add to Update Set" UtilityMany ServiceNow developers use the "Add to Update Set" utility (available on the Developer Share).- Once installed, a related link appears on almost every record in the system.
- You simply click Add to Update Set on the annotation record, and it will be added to your current active set immediately.
Summary TableFeature Captured Automatically? Best Movement MethodForm Layout Yes Update Set Annotation Content No XML Export or Force Script
Please give it a like if you get the solution helpful for you..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @tushar_ghadage 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Please give it a like if you get the solution helpful for you.
