The CreatorCon Call for Content is officially open! Get started here.

with Multirow variable set submit catalog item, need to create one new story record with description

praveen47
Tera Contributor

Hi Developers, 

 

I have a catalog item that include multi row variable set(include 10 variables), While submitting catalog item i need to create a new Story record in the record description field need to update all the Multi row variables data and  variable labels also need to populate.

 

EX: if the variable label is Type in description field need populate:  Type: XYZ.

 

Can any one help me on this.

 

 

6 REPLIES 6

As we already know the Labels of variables in MRVS and MRVS is shown in below format

[ {

//1st row
"variable_name1" : "Value of variable1",

"variable_name2" : "Value of variable2,
},

{

//second row
"variable_name1" : "Value of variable1",

"variable_name2" : "Value of variable2,
}

]

 

In your example shown in screenshot it will be like,

 

[ {

//1st row
"type" : "container start",

"read_only" : "yes",
},

{

//second row
"type" : "", // this will be undefined as its empty

"read_only" : "yes',
}

]

 

In above code you can update below line,

 

grStory.description = "Type=" + parser[i].<type> +' ' + 'Read Only='+ parser[i].<read_only> ;

You can adjust the code as per your need and with best practices.

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

priyasunku
Kilo Sage

Hi @praveen47 

 

var mrvs = current.variables."MRVS-Name";

var desc='';
 
for(var i=0; i<mvrs.length;i++){
   desc+="Color" + " : " +mvrs[i].color +" and "+"Dimension" + " : "+ mvrs[i].dimension + "\n" ;
}
 
Please try this and mark answer as helpful if this works