How to get values of Multi Row Variable Set into description field of a record porducer

Frans Brus - No
Tera Guru

We have a form in our Service Portal which customers can use to order something.
We use a Script to populate different fields from the record producer.

For example:

current.u_external_reference = producer.external_reference;
current.company = producer.account;
current.requested_by = producer.contact;
current.type = 'normal';
current.assignment_group = '5683776bdbab0300bb3288805b961926';
current.contact_type = 'self-service';

var description =
	"Box order for: "+ producer.contact + "\n" +
	"Quantity: " + producer.box_specifications.getRowCount();

Now we want to use a Multi Row Variable set which contain 2 fields.

  • Color
  • Dimensions

I already managed to get the Quantity value in above example.

But how do I get the values for each field in the Multi Row Variable set?
I want to see the box specifications as part of the description field.

Like:

var description =

                "Box order for: "+ producer.contact + "\n" +
                "Quantity: " + producer.box_specifications.getRowCount()
                "Color and Dimensions: " + ??? + "\n" +
                "Color and Dimensions: " + ??? + "\n" +
                "Color and Dimensions: " + ??? ;
                Etc…

It would be nice if for every row the customer ordered something, the specifications will be shown on a new row.

I already did some testing but that did not give any result.

	var description1 = '';
	var mrvs = producer.variables.box_specifications;

	var l = mrvs.getRowCount();
	for(var i = 0; i < l; i++) {
		var row = mrvs.getRow(i);
		var cells = row.getCells();

		var m = cells.length;
		for(var j = 0; j < m; j++) {
			description1+=cells[j].getLabel() + ': ' + cells[j].getCellDisplayValue() + "\n" ;
		}
current.comments='test ' + mrvs;

var description =
                "Box order for: "+ producer.contact + "\n" +
                "Quantity: " + producer.box_specifications.getRowCount()  + "\n" +
                "Color and Dimensions: " + "\n" + description1;

Hope anyone can help.

Many Thanks

1 ACCEPTED SOLUTION

Shruti
Mega Sage
Mega Sage

var mrvs = producer.variables.box_specifications;

var desc='';
 
for(var i=0; i<mvrs.length;i++){
   desc+="Color" + " : " +mvrs[i].color +" and "+"Dimension" + " : "+ mvrs[i].dimension + "\n" ;
}
 
 
Note: Replace color and dimension with the actual variable names in Multi row variable  set (mvrs[i].color and mvrs[i].dimension)

View solution in original post

5 REPLIES 5

Gabriela Freita
Tera Contributor

I would like some help, I have a Record Producer "Form" where inside it I have a multi-row variable, I created another Reord Producer "Form" and created another multi-row, I wanted to know if there is a way to automatically copy the information from the first multi-row to each other on forms that have the second multi-row