0 votes
in Rock by TinaStephens (8.6k points)
edited

I see Group Types have a Group Member Workflow trigger option of "Member Added to Group". Can I use this to send a notification the Group Leaders when a person is added to a Group?

1 Answer

0 votes
by TinaStephens (8.6k points)
edited
 
Best answer

Yes, you can use a workflow to send a notification. The trigger on the "Group Member Workflow" in the Group Type will look like this:

enter image description here

The workflow

  1. Automatically Persisted

  2. Attributes will beenter image description here

  3. Start Activity Actions:

    1. Get Group Member (Action Type Attribute Set From Entity)enter image description here

    2. Get Group Member If Entity Not Passed In (SQL Run)

      enter image description here

    3. Get Leader Email (Lava Run)

      enter image description here

      This is the lava:

      {% assign emails = '' %}
      {% assign group = Workflow | Attribute:'Group','Object' %}
      {% assign members = group.Members %}
      {% for member in members %}
          {% if member.GroupRole.IsLeader == true and member.GroupMemberStatus == 1 %}
              {% assign emails = emails | Append:member.Person.Email | Append:',' %}
          {% endif %}
      {% endfor %}
      
      {% assign emails = emails | ReplaceLast:',','' %}
      {{ emails }}
      
    4. Notify Group Leaders (Email Send)

      enter image description here

      This is the Lava:

      {% assign groupLeader = Workflow | Attribute:'GroupLeaderPerson','Object' %}

      {% assign newGroupMember = Workflow | Attribute:'GroupMember','Object' %}

      {{ 'Global' | Attribute:'EmailHeader' }}

      <p>Hello,</p>

      <br>

      <p>This is a notification to let you know that <b>{{ newGroupMember.Person.FullName }} </b>has been added to the group "{{ newGroupMember.Group.Name }}".</p><br>

      <p>Email: {{ newGroupMember.Person.Email }}</p><br>

      <p>Phone: {{ newGroupMember.Person | PhoneNumber:'Mobile' }}</p>

      {{ 'Global' | Attribute:'EmailFooter' }}

    5. Activate Workflow Complete (Activate Activity)

    6. Workflow Complete

Welcome! Here you can ask questions and receive answers (hopefully) from other members of our team.
...