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

Its already there

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 

 

as per your suggestion i have modified and tried your script now not even field labels are also not printing

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());
		}

Can you share your complete script here

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 please find below complete script

 

if (gr.cat_item == gs.getProperty('imc_cat_item_move_request')) { //sys_id for 'move request'
		if (gr.variables.move_for == 'individual'){
			template.print('\nItem Description: \n' + gr.description + '\n');
		}
		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());
		}
	}

Where are you defining gr.. ? give that too

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..:)