cancel
Showing results for 
Search instead for 
Did you mean: 

Script to send email to all users of a user group dynamically

tejasjani
Product and Topic Expert
Product and Topic Expert
0 Kudos
93

Hi,

I require to send custom email notification from a Sourcing Script to a Sourcing Group (All the users in a particular Group). This is required at the 'save' event of Supplier registration request creation via workflow.

I have been able to send mail to a particular email address from the script on supplier registration request when a new supplier registers from external url. Now I want this email to go to email addresses of all the users of a particular group.

Can someone please guide from java coding perspective on how to achieve this?

Thanks in advance.

Tejas

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

Have you tried getting the list of users EMAIL using the com.sap.odp.api.usermgmt.masterdata.GroupMemberSubIBeanIfc  IAPI usermgmt$masterdata.groupmember.class_name ?

Heres a snippet:

  1. emailMessage.setFrom(fromEmail);

// if not set, this should default to the company from email

  1. emailMessage.setRecipients(new String[] { key });

//  fill the key with the groups EMAILS.

  1. emailMessage.setSubject("subject here");

// if not set, this should use the mail template subject

  1. emailMessage.setMailType(new MailTypeEnum(MailTypeEnumType.ODP_ALERT_MSG));

// must be a valid email template

Thanks,

Paul