getting undefined while accessing multi row variable set variables in the email notification

sinu2
Tera Expert

I have one Multi row variable set in my catalog item and the same i wanna get in my approver email notification

 

1.but while accessing those values with toString() method i am getting "undefined"

2. and even for getDisplayvalue() also coming same

3. but when i accesing directly , it is priting sys_id's

 

if (gr.variables.move_for == 'group')
		{
			var mrvs_data_group = '';
		var mrvs_group = gr.variables.group_move_mrvs; //replace with the internal name of your MRVS
		var rowCount = mrvs_group.getRowCount();
		for (var i = 0; i < rowCount; i++) {
			var row_group = mrvs_group.getRow(i);
			mrvs_data_group += '\n----------' + '\n' +
				'User: ' + row_group.user.name.toString() + '\n' +
				'To Home Base: ' + row_group.to_home_base_bulk.name.toString() + '\n' +
				'To Floor: ' + row_group.to_floor_bulk.name.toString() + '\n' +
				'To Space: ' + row_group.to_space_bulk.name.toString() + '\n' +
				'Date: ' + row_group.employee_requested_move_date + '\n' +
				'From Home Base: ' + row_group.from_home_base.name.toString() + '\n' +
				'From Floor: ' + row_group.from_floor.name.toString() + '\n' +
				'From Space: ' + row_group.from_space.name.toString() + '\n' ;
				
	    }
		
		template.print('Move Participants: ' + mrvs_data_group.toString());
		}
11 REPLIES 11

Sohithanjan G
Kilo Sage
Kilo Sage

Hi @sinu2 , 

 

Here's a revised snippet of your code with some adjustments:

for (var i = 0; i < rowCount; i++) {
    var row_group = mrvs_group.getRow(i);
    var user = row_group.variables.user.displayValue || '';
    var toHomeBaseBulk = row_group.variables.to_home_base_bulk.displayValue || '';
    var toFloorBulk = row_group.variables.to_floor_bulk.displayValue || '';
    var toSpaceBulk = row_group.variables.to_space_bulk.displayValue || '';
    // Similarly, get other field values

    mrvs_data_group += '\n----------' + '\n' +
        'User: ' + user + '\n' +
        'To Home Base: ' + toHomeBaseBulk + '\n' +
        'To Floor: ' + toFloorBulk + '\n' +
        'To Space: ' + toSpaceBulk + '\n' +
        'Date: ' + row_group.variables.employee_requested_move_date + '\n' +
        'From Home Base: ' + row_group.variables.from_home_base.displayValue + '\n' +
        'From Floor: ' + row_group.variables.from_floor.displayValue + '\n' +
        'From Space: ' + row_group.variables.from_space.displayValue + '\n';
}

 

Please mark the answer as Accepted as Solution & hit helpful !! 

Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)

Hi @Sohithanjan G 

 

i am trying to add your script but could not able to save the script itself. If possible could you kindly paste the entire modified code?

 

if (gr.variables.move_for == 'group')
		{
			var mrvs_data_group = '';
		var mrvs_group = gr.variables.group_move_mrvs; //replace with the internal name of your MRVS
		var rowCount = mrvs_group.getRowCount();
	for (var i = 0; i < rowCount; i++) {
    var row_group = mrvs_group.getRow(i);
    var user = row_group.variables.user.displayValue || '';
    var toHomeBaseBulk = row_group.variables.to_home_base_bulk.displayValue || '';
    var toFloorBulk = row_group.variables.to_floor_bulk.displayValue || '';
    var toSpaceBulk = row_group.variables.to_space_bulk.displayValue || '';
    // Similarly, get other field values

    mrvs_data_group += '\n----------' + '\n' +
        'User: ' + user + '\n' +
        'To Home Base: ' + toHomeBaseBulk + '\n' +
        'To Floor: ' + toFloorBulk + '\n' +
        'To Space: ' + toSpaceBulk + '\n' +
        'Date: ' + row_group.variables.employee_requested_move_date + '\n' +
        'From Home Base: ' + row_group.variables.from_home_base.displayValue + '\n' +
        'From Floor: ' + row_group.variables.from_floor.displayValue + '\n' +
        'From Space: ' + row_group.variables.from_space.displayValue + '\n';
}
		
		template.print('Move Participants: ' + mrvs_data_group.toString());
		}

 

Please mark the answer as Accepted as Solution & hit helpful !! 

 

Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)

@Sohithanjan G  i am looking for templete.print line