getting undefined while accessing multi row variable set variables in the email notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 08:19 AM
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());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 08:52 AM
Its already there
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 09:00 AM
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());
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 09:02 AM
Can you share your complete script here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 09:05 AM
@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());
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 09:43 AM
Where are you defining gr.. ? give that too