Jason Values

Kanna12
Tera Expert

I have cretaed Sys_property : Authorization group where i have added values.

{"group value":"group sys_id",

"group value"1:"group sys_id1",

"group value2":"group sys_id2"

}

 

In the workflow if i  selected one group workflow needs to send an approval to remaining groups  (not current group which i selected).

I written below code but it is sending to all 3 groups.

 

var GroupProperty=jsonProperty.parse(gs.getProperty('Authorization group'));

for(var i in GroupProperty) {
if( i!== currentChgCreationGrp) {
answer.push(GroupProperty[i]);
}
}

 

 

Could any one please help this much appreciated!

Thank you,

Gayam

2 ACCEPTED SOLUTIONS

Adrian Ubeda
Mega Sage
Mega Sage

Hello @Kanna12 ,

I'd recommend you to use a separeted-comma value in the sys_property instead using JSON structure, I let you a useful code for pop out value from array when it's found:

var groups = '019ad92ec7230010393d265c95c260dd,477a05d153013010b846ddeeff7b1225,553032e853165110b846ddeeff7b12aa';
var arrGroups = groups.split(',');
var index = arrGroups.indexOf('477a05d153013010b846ddeeff7b1225');
if (index > -1) { // only splice array when item is found
  arrGroups.splice(index, 1); // 2nd parameter means remove one item only
}
gs.info(arrGroups);
If it was helpful, please give positive feedback! ✔
☆ Community Rising Star 22, 23 & 24 ☆

View solution in original post

my original Properties are
{"it_dev":"f5ecc7a31b7dbd10bf2210ad9c4bcb16",
"it_test":"026d87a31b7dbd10bf2210ad9c4bcb85",
"it_preprod":"187d0fa31b7dbd10bf2210ad9c4bcb1e",
"it_prod":"388d0fa31b7dbd10bf2210ad9c4bcb20"
}

View solution in original post

6 REPLIES 6

@Kanna12  have you tried with script which I have provided ? It will work. i have tested with your new json values as well.  

It worked out!
Thank you!
Much appreciated