Hide Custom Button on the Portal

sanvi
Tera Expert

Hi All,

I want to hide a button called 'Assign' on the portal but it should display as is on the backend view i.e is native view.

Tried the below script (on load client script) but its not working.

 
setTimeout(function() {
 
                    disableButtons();
}, 1000);
 
function disableButtons() {
if(g_form.getValue('state') == '-15' || g_form.getValue('state') == '-16'){
    var btn = this.document.getElementsByClassName("btn btn-default m-r-xs");
 
    for (i = 0; i < btn.length; i++) {
        if (btn[i].innerText == 'assign') {
 
            btn[i].style.display = 'None';
 
                    }
}
 }
}
 
Can anyone suggest.
1 ACCEPTED SOLUTION

@sanvi 

why not make that UI action as client side and then it will only show in native and not in portal?

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

View solution in original post

10 REPLIES 10

@sanvi 

you are using wrong syntax for gsftSubmit

Please check docs and correct it

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