Setup workflow condition for Multirow variable set

sreejith05
Giga Expert

Hi Team,

I am using a multi row variable set as below. "Item name" is a lookup select box variable and i wanted to configure the manager approval if the requester selects the item name "Other'. How can i setup the same in the workflow.

find_real_file.png

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

You can use a script like this in the Approval - User activity.  If the Item Name of Other... is not found in one of the rows, then no approver will be populated, so the activity will be skipped.

var answer = [];
var mrvs = current.variables.mrvs_internal_name;//replace with the internal name of your MRVS
var rowCount = mrvs.getRowCount();
for(var i=0;i<rowCount; i++){//for each row in the MRVS
  var row = mrvs.getRow(i); 
  if(row.item_name == 'Other'){//replace with your MRVS variable name and correct value
    answer.push(current.opened_by.manager.toString());
  }
}

View solution in original post

5 REPLIES 5

Hi Sofiya,

It sounds like an If activity would be best since there are 2 possible paths, although I'm not clear on what should happen if one row has Cloud Admin Access and another row has another choice.  The Advanced script would look something like this:

answer = ifScript();

function ifScript() {
	var result = '';
	var mrvs = current.variables.account_access; //internal name of MRVS
	var rowCount = mrvs.getRowCount();
	for (var i = 0; i < rowCount; i++) { //loop through each row of the MRVS
		var row = mrvs.getRow(i);
		if (row.v_account_access == 'Cloud Admin Access') { //your variable name and select box choice value
			result = 'yes'; //follow the path for Flex team approval
		}
		else {
			result = 'no'; //follow the path to create a task
		}
	}
	return result;
}

As written, all MRVS will be evaluated, but the 'result' and hence the If activity path will be determined by the value in the last row, but this gives you the syntax and format on how to use an MRVS in a workflow/server script.