Most people won’t know that as of the beginning of September 2020, AMDH Services has a real physical office rather than just my home office. We’re now based in an Office in Marble Hall, an old Rolls Royce building in Derby.
This building is a multi-tenant property designed for use by small businesses managed by Derby City Council on behalf of Connect Derby. Each morning the mail comes into Marble Hall to reception and then reception email all tenants to say that the mail has arrived and each business has to send someone down to reception and ask whether any has arrived for them.
As you can imagine this must waste a lot of time for the reception staff at Marble Hall as well as the tenants. There must be a better way I hear you say.
I thought the same thing – a way for reception to easily email the individual tenants who have received mail but without having, in each instance, to compose a mail message to a tenant saying “you’ve got mail” with a salutation and regards etc.
To do this using PowerAutomate and PowerApps is really fairly trivial. The challenge is knowing which options to select at each stage in order to get the options you want.
PowerAutomate for Sending Emails
As far as I have been able to find out PowerApps itself cannot send emails – it relies upon an automation being configured in PowerAutomate in order to send emails. So we need to find a suitable automation that will allow us to send an email and then we will associate that automation with a button and use the button to pass some data – who we want the email to go to – to the automation.
Access Power Automate from the Office 365 portal at portal.office.com
This opens up Power Automate
From here select the “Create” option in the left navigation
This gives us three ways to filter what we want to automate (of which only the first two are shown in the screen shot):
- Start from blank – determine the type of flow based on whether its going to be an automated flow, instant flow, scheduled flow etc- so based on the type of flow
- Start from template – this allows us to choose from some examples
- Start from a connector – this allows us to choose based on what service we want the automation to relate to e.g. sharepoint, outlook, SQL server etc
In this instance what we want is fairly simple – we want to click a button or link in a Power App and for this to trigger an email to be sent – so we need to find the trigger (click a button) then add the action (send an email). Under the “Start from blank” section you can see “Instant flow” we’ll use this option, so select “Instant flow” and the give the flow a name and select “PowerApps” and click “Create”
This will bring up the flow configuration window where at present we only have a single item labelled “PowerApps”. This is what allows us to use this flow inside the PowerApps tool when we are building an application.
Next we want the flow to send an email so select “+ New step” and into the search box type something like “send email” this brings up the list of options below
I’m using Office 365 email so I selected here “Send an email (V2)” but if you were using Gmail or another email platform there are other options lower down. This brings up the “Send an email (V2)” configuration window where you need to specify the “To”, “Subject” and “Body” fields.
We want the “Subject” and “Body” fields to be fixed – we want them to say “You’ve Got Mail!” and “Come to reception to collect your mail” or something similar, but we want the email address to be chosen based on how the flow is used in PowerApps.
So type into the “Subject” and “Body” fields the information required but when you click into the “To” field select the “Add dynamic content” button below and to the right of the “To” box and then select “Ask in PowerApps”.
Your flow should now look something like this:
Finally click “Save” to save the flow.
That’s it so far as PowerAutomate is concerned – now we need to create and configure our app in PowerApps.
PowerApps to add a User Interface
Access PowerApps from the Office 365 portal at portal.office.com in much the same way we did when we accessed PowerAutomate.
In this instance we’re going to create a Canvas App so select “Canvas app from blank” in the middle of the page:
When you select this you are asked to give the app a name and choose for it to be formatted for Tablet or Phone – I think this app is most likely to be used via a browser on a PC so I’ve chosen “Tablet”.
The screen will now show “Loading” following by “Getting things ready” before taking you into Power Apps Studio where you will configure your app. Now its quite straight forward here to add a background image and give the app a title, so I’m not going to talk through how this is done.
What I will explain is how I added the semi-transparent background to the title text “You’ve Got Mail!”
The title object has some Advanced properties one of which if the “Fill”, this can be defined as RGBA(aR, bG, cB, dA) where aR, bG and cB are integer numbers from 0 through to 255 and define colour as you would expect, dA however is the transparency of the object from 0 to 1 – I set it to 0.7 so the title showed up against the background a little better.
The only other objects on the canvas are the buttons themselves – I created (for my example app) ten of these labelled “Office 1” through to “Office 10”. To create a button move through to the “Insert” tab on the top ribbon and select “Button”.
Now we need to associate each button with the power automate action and add in the email address we want the specific button to email. To do this we select the button we want to configure and set the “OnSelect” property to be:
[NameofAutomation].Run([parameters to pass])
So for me in this example the configuration is:
This procedure needs to be repeated for each button until its completed for all buttons.
Once you are finished go the “File” menu and select “Save”. Your new app will now be listed in the list of PowerApps in your Office 365 tenancy.