Approval based on list collector

carlc
Kilo Contributor

Anyone has any luck creating approvals based on items selected from a list collector. I have a list of 255 items and each have their own approval groups.

6 REPLIES 6

Ok, I assume that the group is a different field on your record and not displayed on the list collector, then you have to fetch it, You should try this code in approval group advanced script



var answer = [];


var collector = current.variables.list_collector_variable.toString(); // (Replace list_collector_variable with your variable name)


var list = collector.split(",");


for(var i=0; i< list.length; i++){


  var gr = new GlideRecord('table_name');   //Replace table_name with the one of list collector variable


  if(gr.get(list[i])){


          answer.push(gr.approval_group);       // Replace approval_group with its actual column name


    }


}



Thank You


Please Hit Like, Helpful or Correct depending on the impact of response


Hi,

 

Wanted to know if there are 2 list collector variables basis which the approvals are to be triggered as per the selection, how can we achieve that?

The above code works when we are using just one list collector. How can we do it when it comes to 2 similar variables.

Any help will be appreciated.

 

Regards,

Surabhi