How to disable the Add and delete button in Multi Row variable set

skumars1808
Tera Contributor

I have the requirement to show a list of users in a MRVS in a RITM. There will be only one column editable in the MRVS and rest of the columns will be read only. We do not want any one to be able to add any extra rows or delete the rows from the MRVS once the request is created.

Can anyone please help me how to achieve this?

 

4 REPLIES 4

Stephen Sturde
Tera Guru

Michael Jones -
Giga Sage

Would this be on the RITM record in the Platform UI?

Something like this has worked for me in the past: I commented out the line that hides the edit pencil. 

function onLoad() {
    var mrvsid = 'f0ce3f2b07b1a010c5cff1e08c1ed045'; //sys_id of the MRVS
    document.getElementById('table_variable_buttons_' + mrvsid).style.display = 'none';

    var mrvs = g_form.getValue('mvrs'); // name of the MRVS
    var obj = JSON.parse(mrvs);
    for (var i = 0; i < obj.length; i++) {
        document.getElementsByClassName('btn-sm icon-cross multi-row-delete-row')[i].style.display = 'none';
        //hide edit icon on each row of MRVS
        //document.getElementsByClassName('btn icon-edit btn-sm')[i].style.display = 'none';
    }


}

I hope this helps!

If this was helpful or correct, please be kind and remember to click appropriately!

Michael Jones - Proud member of the CloudPires team!

I hope this helps!
Michael D. Jones
Proud member of the GlideFast Consulting Team!

Gabriel3
Giga Contributor

For newer versions:

// Dom manipulation
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').hide();
	
	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();
	}, 250);
}

Kim Aly
Tera Contributor

I need to do the opposite: how can I enable editing of the Multi-Row Variable Set (MRVS) on the Requested Item (RITM) after submission? I’ve tried client script or Ui policy , but it still doesn’t work....any idea??