Multirow variable set values in short description of catalog item

Mansi roy
Tera Contributor

Hello,

 

Can anyone please help me on the below requirement.

 

I have a multirow variable set name ' Required Roles'. In this variable set i have one variable with name ' Roles available'. I need to display this 'Roles available' values to short description of the catalog item.

 

I have written one After business rule. But not getting the result.

 

var shdesc='';
var Item = current.getValue('cat_item');
var mrvs = JSON.parse(current.variables.required_roles);//Multirow variable set name
var rowCount = mrvs.getRowCount();
for(var i = 0; i < rowCount; i++){
var row = mrvs.getRow(i);
shdesc ='Request to'+ row.roles_availble;
}
current.short_description = shdesc;
}
})(current, previous);
 
Can anyone please help me how to achieve this one.
 

 
   

 

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

What table is your Business Rule running on?  Since it is after (insert?) you need a current.update() line after making any changes to the current record.  With each MRVS row read, the script variable is getting wiped out so only the value from the last row will be included the way you have it now.  Since this is multiple values with text added, it may work better to use the description field, but whichever you use you need to change this to:

shdesc += 'Request to'+ row.roles_availble;

to append the value with each MRVS row.  The Item script variable is not used, so you can get rid of that line, depending on what table this is running on and what you're really trying to do (update the REQ? RITM? SCTASK?...)