The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Avoid sending out twice the same approval mail to users that are in more than one approval group ...

Zod
Giga Guru

Hi there,

we do have an approval step (normal change request), that adds (depending on some characteristics) different approval groups within the workflow.

I.e. if the risc is very high, an additional management group has to approve together with the CAB. Unfortunately, some people in that group are also part of the CAB group.

This is leading to multiple (equal) approval notifications &/ tasks for those people.

In fact, I would like to keep the approval multiple approval tasks as they show, that we did include those members within the process — but on the other hand I would only like to
have ONE notification to be sent out as well as an automatism to auto-approve the other approval tasks in case a person approved one of them.

Happy for input. As I expect code will be required … I would be happy to get some copy/paste input .. as I'm not that much input scripting …

Your help is highly appreciated!

4 REPLIES 4

rajeevlochan82
Mega Guru

You have to change the approval from group to query based list of users. Store list of first approval in workflow scratchpad variable and compare in second group approval to verify if user was present in old approval list. Below is one snapshot o code which i used for dynamic setting of email cc users



// Get CC User from HR -FB Termination Group


var grcc = new GlideRecord('sys_user_grmember');


      grcc.addQuery('group.name' , 'HR - FB Termination Group');


      grcc.addNotNullQuery('group');


      grcc.addQuery('user.company.name' , 'MILESTONE');


      grcc.query();




while(grcc.next())


{




email.addAddress("cc",grcc.user.email, grcc.user.getDisplayValue());


}


Hi Rajeev,


not 100% sure how to test this, but it look form me that this would delete all except one approval steps for People that would get more approvals.


This is not was I'm looking form.


The approval for each Group is valid and should be created ... just no additional mail should be sent - only one.


And if the approval is done for this one - all other approvals for this Change that are required from this user should be set to approved automatically (maybe with comment, why this happened .. alternatively if should be set to not required anymore ... .


Should be done via a Buriness Rule I assume ...


Michael Fry1
Kilo Patron

Hi Michael,


yes. This Looks perfect - jsut this requires different approval steps to be followed. In my case we only talk about one step with identicall poeple within the some approval Groups.


Anyhow interesting. Thank u.