Group approval activity in workflow editor

SarahBenkad
Tera Contributor

Hello, 

I have a group approval that requires me to add more than 12 conditions, it was suggested that script the conditions due to limitations on the number of conditions we can add. 

 

My conditions are based on a list of projects and groups.  I have stored the list of groups in a seperate property planning to use indexof as part of the script. 

 

I am a bit lost on how I need to script this. 

I have started with the following but it is not working : 

function groupapproproval () {

 

var projectSysIds = gs.getProperty('property_groups_sysID');

var sysIdToCheck =  current.sys_id;

var projectList = projectSysIds.split(',');

if (projectList.indexOf(sysIdToCheck) !== -1) {

return true;

 

} else {

 

return false;

}

}

 

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

Hi Sarah,

The advanced script in the Approval - Group workflow activity is looking to have one or more sys_user_group sys_ids pushed to an array named answer.  'current' refers to the record of the table this is running on, so most likely sc_req_item.  If you have a Catalog Item variable that is a reference to group, you can use current.variables.var_name to retrieve/test the value, or current.field_name if using a field on the RITM record (like assignment_group).