Hide bottom button within the form page

Kishore32
Tera Contributor

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

find_real_file.png

Bottom button

find_real_file.png

Thanks

15 REPLIES 15

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

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

 

Hi,

Did you keep Isolate Script field as False?

Did you add alert and verify?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

I'm not seeing Isolate Script field in Client Script. Can you please help me here how can I display the same?

I'm seeing below error at line 'var buttons = document.getElementsByTagName("button");'

find_real_file.png

 

Thanks

I've made Isolate Script field to false, but still I'm seeing above error when script runs.

Thanks