Controlled Emails Using PowerApps

<< Click to Display Table of Contents >>

Navigation:  Office365 and PowerApps >

Controlled Emails Using PowerApps

If your internal emails are unstructured and your team works on Office365, maybe you could consider an PowerApp solution. This article gives you the basics on how to set one up.

 

Design of Structured Email App

 

If your company does a lot of emails and they are disorganized, what about a menu for each of the different repetitive emails.  Consider things like

Leave Requests

Safety Issues

Ideas for improvement

If these are always posted in the same way to the same people, you can organize them so they arrive the same way every-time. This will then allow you to manage the emails using email rules and alerts.  Yes this is really basic but its better than just random emails.

 

Look at my simple Send Emails App

 

It all starts with a Home screen which would have a menu item for each form. This screen links to only one email form which demonstrates how emails are sent.

The Send Email screen has an email address field, a subject and a body section.  You can lock these fields, combine additional fields and get fancy with lookup fields once you get the hang of PowerApps.  

This will run on phones and PC's.

 

201703_gr_email1       201703_gr_email2

 

 

Preliminary Reading

 

As we are building an email related app, you would do well to read this article at Microsoft.  Read the sections entitled "What you need to do to get started" and "Send Email". You should also read Add a Screen and Navigate Between Screens

 

Lets Build The App

 

Create a Blank App using the Phone Template

Add Office365 Outlook data source as per instructions in Connect To Office365 Outlook section in article at Microsoft

Add 2 screens and rename them

HomeScreen
EmailScreen1

On the HomeScreen, Add a Rectangular Icon and add a Text Box for a menu heading like GR-FX Forms in picture above.

Now Add a Button and change the text of the button to reflect the purpose of EmailScreen1 (Email Garry).

In the OnSelect property of the Button, Add the following formula

Navigate(EmailScreen1,ScreenTransition.Fade)

 

Select  EmailScreen1

We are now going to add the following controls as per the following image

201703_gr_email3

1.Add a Text control which describes the purpose of the form

2.Add a Text Input control. Rename it to InputTo Change its default value to the email address you want to send to

3.Add a Text Input control. Rename it to InputSubject  Change its default value to your desired email subject line

4.Add a Text Input control. Rename it to InputBody. Change the Mode property to TextMode.MultiLine

5.Add a Button. Change the Text of the Button to Send Email.  Find the OnSelect property. Change it to the following

Office365.SendEmail(InputTo.Text, InputSubject.Text, Concatenate(InputBody.Text, ": Additional Text"));Navigate(HomeScreen, ScreenTransition.UnCover)

6.Under Insert Icons, select a Back Arrow.  In the OnSelect property, enter

Back()

Save your App.  Then Preview the App.

 

WOW - What happened in step 5

 

All the magic for this App happens in the one liner under the SendEmail button.  Breaking that down

Office365.SendEmail(InputTo.Text, InputSubject.Text, InputBody.Text)

sends the email using your Outlook Office 365 Account. All new users that run the app, have to approve the use of their email account for this App to work.  

Concatenate(InputBody.Text, ": Additional Text")  

is how you can combine text strings in PowerApps.  This statement is included to demonstrate how you could create a useful Body of the email, say a delimited line as follows  

Peter|Sydney

could use the expression of Concatenate(FirstNameField.Text, "|",CityField.text )   See more on Concatenate here

and finally the Onselect property finishes off with

;Navigate(HomeScreen, ScreenTransition.UnCover)

by using the ; character, it is possible to add the Navigate function to the OnSelect action. This sends the user back to the HomeScreen when the SendEmail function is complete.

 

Good Luck
Garry Robinson
Access MVP since 2006