Bulk Email App

Bulk Email App

Purpose

The Bulk Email App provides an easy, user-friendly way to send emails to specific groups within Campus Wellness or to the entire department.  It connects to the Staff Directory List in SharePoint and pulls email addresses from there, based on the user’s selection(s).

Location

The Bulk Email App can be found in https://apps.powerapps.com/play/e/default-723a5a87-f39a-4a22-9247-3fc240c01396/a/4b05abe2-8e0e-4081-8118-34b6754fbd11.

Design

Creating a Power App requires you to connect to a data source. In this case, we connected to the Staff Directory List in SharePoint to allow it to pull email addresses from the records in that list. Unfortunately, it was named Potential New Staff Directory (TESTING, UNFINISHED) and is stuck with that name since it cannot be changed once connected (we’d have to rebuild the whole app to correct that).

The first page the user is presented with is the Select Email page.  Users select the checkboxes to generate a list of email addresses.  The checkboxes are connected to lists (found in the Backend page) which are connected to the Staff Directory List in SharePoint.  Updating the Staff Directory List changes the generated email lists.

The next page shows the group(s) chosen by the user and the generated email list. If the email list is blank (due to an unknown and unresolved bug), then the user should click the Return to Selection button and click the Generate Email List button until the list displays.

The final page that the user sees contains instructions for using the email list that was just copied to create the email.

The Backend page is hidden from users and is where the generated lists are stored.

Editing

Updating the Staff Directory List changes the generated email lists due to their connection. That list is maintained by the Admin Coordinator.

If group choices need to be added to or deleted from the Select Email page, follow the instructions below.

Adding a group choice

  1. Open the Staff Directory List.

  2. Ensure there is at least one column that will satisfy the condition for the group. If not, you will need to create one and populate the column for each employee with data that satisfies the condition. E.g., if adding a group that is based on having an office in the MC building, you would need to create a Yes/No column (e.g., Office in MC) and ensure there is a checkmark for each staff member who has an office in the MC building.

  3. Update the Add new item form by going to List settings > Item > Column order > Set the order as per your requirement > click OK.

  4. Go to https://make.powerapps.com/.

  5. Find the CW Bulk Email App and click the pencil icon to edit it.

  6. On the SelectEmail page, click the Insert link, open the Input dropdown, and choose Checkbox.

  7. In the Properties area on the right:

    1. Update the name so it corresponds to the option (e.g., MCOnly).

    2. Switch to the Advanced tab and change the Text field from “Option” to the name of the option (e.g., “MC Only”).

    3. Drag the new option to the appropriate location on the page.

  8. Go to the Backend page and add a Text Label for the header of the new group (e.g., MC Only). Copy/paste one of the existing email address areas and change the properties of it to match the new group (e.g., Name = EmailMC, formula is Concat(Filter('Potential New Staff Directory (TESTING, UNFINISHED)','Office in MC'),Email, "; ")

  9. Add a Reset() function to the code for the Reset Selections button so that it will clear that choice when necessary.

  10. Add an IF statement to the code for the Generate Email List button for that choice to work.

  11. Click the Save button.

  12. Click the Publish button.

  13. Click the Play button and ensure the new group choice works.

If you cannot connect to the new option in the formula in step 8, close and re-open the Bulk Email App to re-establish a proper connection to the data.

Deleting a group choice

  1. Go to https://make.powerapps.com/.

  2. Find the CW Bulk Email App and click the pencil icon to edit it.

  3. On the SelectEmail page, click the option you wish to remove and press the Delete key on your keyboard.

  4. Remove the corresponding Reset() function from the code for the Reset Selections button since it is no longer necessary.

  5. Remove the corresponding IF statement from the code for the Generate Email List button since it is no longer necessary.

  6. Click the Save button.

  7. Click the Publish button.

Reset Selections

This button allows the user to reset all of their selected groups using the Reset() function.

The code used to do this is:

Reset(AllStaff)& Reset(SeniorManagement)& Reset(LeadershipTeam)& Reset(Admin)& Reset(AllProviders)& Reset(Counsellors)& Reset(PhysiciansandNPs)& Reset(CSRs)& Reset(AccuroUsers)& Reset(HSOnly)& Reset(NHOnly)

If a choice is added or removed, then the corresponding Reset() function in that code needs to be added/removed for that choice.

Generate Email List

This button pulls the content from the Staff Directory List and creates the list of email addresses.

The code used to do this is:

Set(Recipients, ""); Set(EmailSEND, ""); If(LeadershipTeam.Value=true,Set(EmailSEND, EmailSEND&EmailLeader.Text)&Set(Recipients, Recipients&"Leadership Team")); If(SeniorManagement.Value=true, Set(EmailSEND, EmailSEND&";"&EmailSenior.Text)&Set(Recipients, Recipients&"; Senior Management")); If(Admin.Value=true, Set(EmailSEND, EmailSEND&";"&EmailAdmin.Text)&Set(Recipients, Recipients&"; Administration")); If(AllProviders.Value=true, Set(EmailSEND, EmailSEND&";"&EmailProviders.Text)&Set(Recipients, Recipients&"; All CW Providers")); If(Counsellors.Value=true, Set(EmailSEND, EmailSEND&";"&EmailCounsellors.Text)&Set(Recipients, Recipients&"; Counsellors")); If(PhysiciansandNPs.Value=true, Set(EmailSEND, EmailSEND&";"&EmailPhysicians.Text)&Set(Recipients, Recipients&"; Physicians and NPs")); If(CSRs.Value=true, Set(EmailSEND, EmailSEND&";"&EmailCSR.Text)&Set(Recipients, Recipients&"; CSRs and Supervisors")); If(CSROutofOffice.Value=true, Set(EmailSEND, EmailSEND&";"&EmailCSROutofOffice.Text)&Set(Recipients, Recipients&"; CSR - CS Staff OUT")); If(AccuroUsers.Value=true, Set(EmailSEND, EmailSEND&";"&EmailAccuro.Text)&Set(Recipients, Recipients&"; Accuro Users")); If(HSOnly.Value=true, Set(EmailSEND, EmailSEND&";"&EmailHS.Text)&Set(Recipients, Recipients&"; HS Only")); If(NHOnly.Value=true, Set(EmailSEND, EmailSEND&";"&EmailNH.Text)&Set(Recipients, Recipients&"; NH Only")); If(AllStaff.Value=true, Set(EmailSEND, EmailSEND&";"&EmailAll.Text)&Set(Recipients, Recipients&"; All of Campus Wellness")); If(Left(EmailSEND,1)=";",Set(EmailSEND, Right(EmailSEND, Len(EmailSEND)-1))); If(Left(Recipients,1)=";",Set(Recipients, Right(Recipients, Len(Recipients)-2))); Navigate(EmailList)

If a choice is added or removed, then the corresponding IF statement in the above code needs to be added/removed for that choice.

Access

Access to the Bulk Email App is restricted to the following roles, as they are the only ones who should be sending bulk emails in our department:

  • Admin Coordinator

  • All CSRs

  • Associate Director, Counselling Services

  • Counselling Managers

  • EHR Software Specialist

  • Executive Assistant

  • Executive Director

  • Manager, Information Technology

Managing Access

SharePoint List

  • Click ‘Manage Access’ in the top right corner.

  • Add or remove users as necessary.

Note: Only users with UWaterloo emails will be able to access the list.

PowerApps Form

Note: Only users with UWaterloo emails will be able to access the form.

Functions Used

Set – Sets the value of a variable (Creates and sets the value of a variable if it doesn’t exist).

  • Structure: Set(VariableName, Value)

  • Example: Set(LeftNE1, true)

Navigate – Used to move to a different screen in the form.

  • Structure: Navigate(ScreenName)

  • Example: Navigate(FinalDetails)

Reset – Resets a control to its default state.

  • Structure: Reset(ControlName)

  • Example: Reset(NameSelect)

Copy – Copies selected text to clipboard.

  • Structure: Copy(SelectedText)

  • Example: Copy(EmailSEND)

Exit – Exits the App (and logs them out if requested).

  • Structure: Exit(LogoutStatus)

  • Example: Exit(true) or Exit() - Blank = false

Left – Returns leftmost characters of a string.

  • Example:  Left(“Teststring”,  2) -> “Te”

Len – Returns length of string.

  • Example: Len(“Test”) -> 4