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

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

Thank you so much Brad it really helped me.

If you have some time please check the below one as well.

 

https://community.servicenow.com/community?id=community_question&sys_id=24ba32a2db5cb810190dfb243996...

Hello Brad,

I tried implemented your solution for my requirement but it's not working can you please help me on where i'm missing.

 

https://www.servicenow.com/community/it-service-management-forum/how-to-trigger-manager-approvals-fo...

Sofiya1
Tera Contributor

Hi Brad, 

I have created a variable set Account Access Level, Internal name- account_access. Variable name also Account Access Level(drop down) in that drop down if I select Cloud Admin Access in that drop down it should goes to Flex team approval. if other drop downs selected means it should create task. What code should be written in workflow  to achieve this ?

could you please suggest?

Thanks,

Sofiya