We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to restrict or disable the add button in Multi Row Variable Set after the 5th Row?

RISHAV SANSON
Tera Contributor

I have to restrict the number of rows to 5 but i am not be able to restrict or disable the add button. Could you please share some thoughts or suggestions ? 

33 REPLIES 33

When you say backend, how are you going to use it? Are you suing try it button and checking?

backend as in when you access a catalog item from the instance itself

asifnoor
Kilo Patron

Hi,

I have written an article on how you can disable the buttons in the MRVS . Kindly refer to this.

https://community.servicenow.com/community?id=community_article&sys_id=376e4dfadb7698d0fa192183ca961...

Went through your script for hiding buttons in MVRS. But, unfortunately, it didn't worked out.

For "Remove all"

function onLoad() {
//Type appropriate comment here, and begin script below
//Hide Remove All button on MRVS
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';
}
}
}

For Remove Row:

function onLoad() {
//Hide each X (delete row) icon on MRVS
var icon = this.document.getElementsByClassName("wrapper-xs fa fa-close");
for (j = 0; j < icon.length; j++) {
if (icon[j].getAttribute("title") == 'Remove Row') {
icon[j].style.display = 'None';
}
}
}

 

Can you please help?

Thankyou.

RJ