Hide bottom button within the form page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 03:48 AM
Hi,
I've created a custom button by replacing Update and Delete buttons through UI action.
Now I wanted to hide the bottom button in the form. Could anyone please help me out here.
Top button
Bottom button
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 02:06 AM
Hi,
No other way but to use DOM
Share what script did you try using DOM
Ensure Isolate Script field is set to false to allow DOM to run
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 07:21 AM
Hi Ankur,
I've tried below script in Client Script and no luck.
function onLoad() {
try {
alert("test");
var buttons = document.getElementsByTagName("button");
alert("test1");
alert(buttons);
if (buttons) {
for (var i = 0; i < buttons.length; i++) {
var testClass = buttons[i];
if (testClass.className == 'form_action_button action_context btn btn-default') {
buttons[i].style.display = 'none';
}
}
}
} catch (e) {
alert(e);
}
}
I've also followed below link accepted solution by creating UI policy, but no luck
How to hide UI Action based on field change in form without using DOM?
Please suggest some way to work on this.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2022 09:30 PM
Hi,
Did you keep Isolate Script field as False?
Did you add alert and verify?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 06:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2022 07:06 AM
I've made Isolate Script field to false, but still I'm seeing above error when script runs.
Thanks