Send email to specific workgroup

Hi All,

I want to send the new joiner notification to users in specific workgroup (depending on their department). For example, if they are IT Security, a new email will be send to the admins of IT Security Workgroup (there are multiple admin in the workgroup). How can I achieve that in a rule under to argument in the default notify workflow?

Below is snapshot of my logic:


Identity employee = context.getObjectByName(Identity.Class, identityName);
String employeeJobTitle = identity.getAttribute("title")

//Send email based on Job Title
if (employeeJobTitle.equalsIgnoreCase("Database")){

	emailDest = //send  email to Database Admin workgroup

}else if(employeeJobTitle.equalsIgnoreCase("IT Security")){

	emailDest =  //send email to IT Security Admin workgroup
}else{//All other users

	emailDest = //Send email to their managers

}

What classes would return the manager email and also return the emails of users in the specific workgroup?

2 Likes

To get the email addresses of everyone in a workgroup, use:

Identity workgroup = context.getObjectByName(context, workgroupName);
List emails = sailpoint.api.ObjectUtil.getEffectiveEmails(context, workgroup);

To get the manager email:

String email;
Identity manager = identity.getManager();
if (manager != null) {
   email = manager.getEmail();
}