How can we disable the pencil icon in Multi Row Variable Set for certain record?

Aarushi2
Mega Contributor

my Requirement is to disable the pencil icon i.e Edit icon in a multi-row variable set for a certain record?

Any solution would be welcome.

Thanks in advance

find_real_file.png

1 ACCEPTED SOLUTION

Hello Arushi,

Good to know that my articled helped you. If you want to hide for specific icon, there is no directly way.

In your rows , you can do a check for the text in the 1st column (after pencil) and if that matches you can hide it. Here is sample code for that.

    icon = this.document.getElementsByClassName("wrapper-xs fa fa-pencil");
    for (i = 0; i < icon.length; i++) {
        if (icon[i].getAttribute("title") == 'Edit Row') {
            if (icon[i].parentNode.nextElementSibling.innerText == 'YOUR TEXT') {
                icon[i].style.display = 'None';
            }
        }
    }

In the code, replace it with your text and then check. Then it will disable the pencil icon only for that row having that text.

Mark the comment as a correct answer and helpful once worked.

 

View solution in original post

13 REPLIES 13

sir 

can we apply it on any variable having a choice list for specific items?

 

Hi,

When it comes to the MRVS table on the catalog item view, they are plain strings. So yes you can apply on any variable.

If this has answered your question, kindly mark the comment as a correct answer and helpful so that the question is moved to the solved list.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Aarushi,

please use onload catalog client script

  1. Ensure Isolate Script field is set to false
  2. This field is not on form but from list you can make it to false

If you want to hide it on RITM then use Applies on Requested Item -  True

If you want to hide it on SC Task then use Applies on Catalog Task  - True

function onLoad() {
    //Type appropriate comment here, and begin script below

   var z = this.document.getElementsByClassName("btn icon-edit btn-sm");

   z[0].style.display = 'none';

}

find_real_file.png

Regards
Ankur

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