- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2022 10:24 PM
Hi folks,
I tried using DOM manipulation to hide "Remove all" and "Remove Row" from MRVS, but unfortunately, it didn't worked out. Went through few codes across community but no luck.
Here's my code:
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 me out ? Wondering what I'm missing here. As, I'm still able to see those two icons on my SP.
Thanks
Cheers,
RJ
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2022 03:49 PM
Yes! did tried those steps but no luck whatsoever.
Anyway, in the above code I've changed it a bit and now "Remove Row" button is hidden on MRVS.
function onLoad() {
setTimeout(function() {
disableButtons();
}, 500);
}
function disableButtons() {
var my_var = g_form.getField("mvrs_internal_name");
var icon = this.document.getElementsByClassName("wrapper-xs fa fa-close");
for (i = 0; i < icon.length; i++) {
//alert(icon[i].getAttribute("data-original-title"));
if (icon[i].getAttribute("data-original-title") == 'Remove Row') {
icon[i].style.display = 'None';
}
}
}
So, in if condition I've replaced existing condition with :
if (icon[i].getAttribute("data-original-title") == 'Remove Row')
And, eventually, that button/Remove Row is hidden on MRVS.
Cheers,
RJ

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2022 10:28 PM
Hi there,
Do you want to hide this on the Service Portal or on the Platform UI?
If Service Portal:
2020-05-18 Changing Service Portal widgets look and feel without cloning widgets
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2022 10:37 PM
Thanks for your response Mark. Those icons are OOB for MRVS which I'm using in my service portal. Went through the link you've shared but still couldn't see anything related to MRVS.
Thanks
RJ.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2022 11:04 PM
So did you try to simulate what's mentioned in the article? It's indeed not MRVS specific, because it's Portal.
See what I did below, inspected the button, added CSS, button is not shown anymore.
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP
---
LinkedIn
Community article, blog, video list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2022 03:49 PM
Yes! did tried those steps but no luck whatsoever.
Anyway, in the above code I've changed it a bit and now "Remove Row" button is hidden on MRVS.
function onLoad() {
setTimeout(function() {
disableButtons();
}, 500);
}
function disableButtons() {
var my_var = g_form.getField("mvrs_internal_name");
var icon = this.document.getElementsByClassName("wrapper-xs fa fa-close");
for (i = 0; i < icon.length; i++) {
//alert(icon[i].getAttribute("data-original-title"));
if (icon[i].getAttribute("data-original-title") == 'Remove Row') {
icon[i].style.display = 'None';
}
}
}
So, in if condition I've replaced existing condition with :
if (icon[i].getAttribute("data-original-title") == 'Remove Row')
And, eventually, that button/Remove Row is hidden on MRVS.
Cheers,
RJ