Hide the "Post Additional Comments" button on the SOW form.

raviteja1600
Tera Contributor

Hi Everyone,

 

I successfully hidden the "Post" buttton on the Classic form. But I am not able to hide the "Post Additional Comments" button on the SOW form.

 

Code I used for Classic Form:

UI Policy -- When Assigned to Is empty & runs on Desktop

 

function onCondition() {
    var thePostButton = document.getElementsByClassName('btn btn-default activity-submit');
    for (var i = 0; i < thePostButton.length; i++) {
        thePostButton[i].style.color = 'transparent';
        thePostButton[i].style.background = 'transparent';
        thePostButton[i].style.borderor = 'none';
        thePostButton[i].style.visibility = 'hidden';
    }
}
 
Coming to SOW Form,
Code I used for SOW form but not working.
UI Policy -- When assigned to is empty & runs on Desktop

function onCondition() {
    var thePostButton = document.getElementsByClassName('now-button -tertiary -md is-disabled');
    for (var i = 0; i < thePostButton.length; i++) {
        thePostButton[i].style.display= 'none';
    }
}
 
Please correct me where I am doing wrong. 
@Ankur Bawiskar 
2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@raviteja1600 

that script won't work in workspace as it used DOM manipulation

If you use UI policy which makes comments or work notes mandatory then that button will be gone

AnkurBawiskar_0-1748010184418.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Is it possible to do for a particular table when the conditions are met.

 

Like, in the Interaction form when the "Assigned to is Empty" in the "Serivce Operations Workspace" the Post Additional Comments button needs to hidden.