Hide Annotations based on UI policy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi Community, Good Day,
I am stuck in a requirement, the requirement to hide Annotation using UI policy when state is in progress then annotation should not visible. I am using this solution.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @DevYadav ,
You can use toggleAnnotations() or hideAnnotation method for this.
GlideForm (g_form) | ServiceNow Developers
Thanks
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
42m ago
Could you please share a working code for this in your PDI just to check if that actually works?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @DevYadav ,
In this case, it might be best to use g_form.addInfoMessage instead of the annotation field. You can manage addInfoMessage through the UI Policy script or Client Script. Could you clarify your requirement for better understanding?
Regards,
Sarah Bioni
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
I think it's not possible to show/hide it using script directly
you need to use DOM manipulation for this
Note: DOM manipulation is not recommended practice
// Hide the annotation
$('my_annotation').up().show();
// Hide the annotation
$('my_annotation').up().hide();
Ensure Isolate Script Field for your UI policy is False to Allow DOM
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
