Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to disable remove and add button on MRVS

Vinod S Patil
Tera Contributor

Hello Everyone


I need to disable multirow variable set buttons(add and remove all) edit button should be visible on RITM. I tried this by using client scrip in my pdf which applies on RITM but it is working for catalog item view not on RITM.

Please suggest on this.

 

function onLoad() {

    //Type appropriate comment here, and begin script below

    setTimeout(function() {

        disableButtons();

    }, 2000);

}

//var n = new GlideRecord('sc_req_item');

//n.query();

//while (n.next()) {

function disableButtons() {

    var mrvsid = '41226d96c32222104b501533e4013121';

    this.document.getElementById(mrvsid + '_add_row').style.display = 'none';

 

    var mrvs = g_form.getField("mrvs1"); //internal name of MRVS

    mrvs.max_rows_size = 0;

    var btn = this.document.getElementsByClassName("btn btn-default");

    for (i = 0; i < btn.length; i++) {

        if (btn[i].innerText == 'Remove All') {

            btn[i].style.display = 'None';

        }

    }

}

@Ankur Bawiskar 

6 REPLIES 6

paynityam
Tera Contributor

Hi Anubhav,

 

This code is not working for me I tried on load

Hi @paynityam ,

Could you please post the client script code snippet of what you are trying.