- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2025 04:49 AM
Hi Everyone,
My requirement is to hide catalog variables / variable editor / whole section (anyone is fine) for one catalog item in RITM and Task views based on a condition. I created an on load catalog client script applies on RITM and Task view. how to hide the catalog variables / variable editor / whole section ?
I tried g_form.setDisplay('variable_editor', false) // did not work
please pour your insights
Thank you!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2025 04:58 AM
there is no direct way for this.
You will have to use DOM manipulation for this and DOM is not recommended.
If you still want then this will work in client side
Note: Isolate Script Field Should be False for DOM to run
// hide
document.getElementsByClassName('veditor_header')[0].style.display = 'none';
document.getElementsByClassName('veditor_body')[0].style.display = 'none';
// show
document.getElementsByClassName('veditor_header')[0].style.display = '';
document.getElementsByClassName('veditor_body')[0].style.display = '';
Before:
After: when I ran the code it's gone
OR
If you don't want to use DOM then use this
1) add the variable editor in a new form section
2) then use this to show/hide the section. section is hidden variable editor is gone
g_form.setSectionDisplay('variables', false); // use correct section name
💡 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2025 05:42 AM
thanks for sharing the same solution again which I already shared.
Any reason to repeat the same again as that might confuse the member who asked the question?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2025 06:01 AM
Hi @Ankur Bawiskar ,
My intension is not coping your answer, I checked the classname is same and I checked and research that sometime macro run late so I added the setTimeOut function. So I added some extra things in my answer.
Thanks,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2025 06:07 AM
timeout should help in onLoad client script
thanks for clarifying
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
