Hiding MRVS Buttons on a Service Catalog

Walter Toney
Tera Expert

i have a requirement to hide the REMOVE all button .. they are scared someone might delete all.. even though you have to say yes and it has be approved to do so...

 

so im asking you .. is there a way script wise to just hide the remove all button... 

2 REPLIES 2

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,

Please refer below post.


 

How to hide buttons in Multi-Row Variable Sets (MR... - ServiceNow Community


Thanks and Regards,

Saurabh Gupta

Vishal Birajdar
Giga Sage

Hello @Walter Toney ,

 

We had same requirement previously.

To disable button on catalog task level. hope this will help you.

 

We have written onLaod Client script which run's on Catalog Task Level

 

var htmlDoc = false;

if (top.document.getElementById('gsft_main'))
    htmlDoc = top.document.getElementById('gsft_main').contentWindow.document;
if (!htmlDoc) {
    if (document) { htmlDoc = document; }
    else if (top) { htmlDoc = top.document; }
}

// Add and Remove All

if (htmlDoc) {

 htmlDoc.querySelector('.sc-table-variable-buttons').style.visibility= 'hidden';
    setTimeout(function() {

        // delete button 
        htmlDoc.querySelectorAll('.multi-row-delete-row').forEach(function(el) { el.hide(); });

       
        //edit button

    //htmlDoc.querySelectorAll('.sc-multi-row-actions > .icon-edit').forEach(function(el) { el.hide(); });  

//      //both buttons (and also the column)
//      htmlDoc.querySelectorAll('.sc-multi-row-actions').forEach(function(el) { el.hide(); });
//      htmlDoc.querySelector('.sc-table-variable-header:first-child').hide();

    },2000);

}

   

}

 

 Output : 

 

VishalBirajdar7_0-1694013102862.png

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates