Send Email to a list of users with role as Admin

cancel
Showing results for 
Search instead for 
Did you mean: 
Akruti
Member II

Send Email to a list of users with role as Admin

I have users who have a list of authorities defined in my SpringBoot application

I have the flow given below, here instead of sending it to a particular email, I want to send it all admin users with the role as "ROLE_ADMIN.. is that possible through activiti?  I have added my User class here as well 

public class User implements UserDetails, AuthenticatedPrincipal {

  @Id private String email;
  private String firstName;
  private String lastName;
  private String phone;
}
<sequenceFlow id="flow1" sourceRef="leaveRequest" targetRef="sendMail" />
        <serviceTask id="sendMail" activiti:type="mail">
            <extensionElements>
                <activiti:field name="from" stringValue="abc@gmail.com" />
                <activiti:field name="to" expression="${emailId}" />
                <activiti:field name="subject" expression="Leave request from ${name}" />
                <activiti:field name="html">
                    <activiti:expression>
                        <![CDATA[
                        <html>
                            <body>
                                Hello ${name}, is requesting for ${days} of leave.
                                <br/><br/>
                                Kind regards,<br/>
                                TheCompany.
                            </body>
                        </html>
                        ]]>
                    </activiti:expression>
                </activiti:field>
            </extensionElements>
        </serviceTask>