<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>PowerApps on LinkeD365 Blog</title><link>https://linked365.blog/tags/powerapps/</link><description>Recent content in PowerApps on LinkeD365 Blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Wed, 18 Mar 2020 00:00:00 +0000</lastBuildDate><atom:link href="https://linked365.blog/tags/powerapps/index.xml" rel="self" type="application/rss+xml"/><item><title>Incident App (Part 2)</title><link>https://linked365.blog/2020/03/18/incident-app-part-2/</link><pubDate>Wed, 18 Mar 2020 00:00:00 +0000</pubDate><guid>https://linked365.blog/2020/03/18/incident-app-part-2/</guid><description>&lt;img src="https://linked365.blog/images/2020/02-image-15.png" alt="Featured image of post Incident App (Part 2)" />&lt;p>In the first part of this series, &lt;a class="link" href="https://linked365.blog/2020/02/23/incident-app-part-1/" target="_blank" rel="noopener"
>here&lt;/a> I established an application I wrote to improve incident management at the club I am proud to chair.&lt;/p>
&lt;h2 id="requirements">Requirements&lt;/h2>
&lt;ul>
&lt;li>Centralised, secure list of incidents - (&lt;a class="link" href="https://linked365.blog/2020/02/23/incident-app-part-1/" target="_blank" rel="noopener"
>Part 1&lt;/a>)&lt;/li>
&lt;li>Ability to add divers to list for trials or competitions (&lt;a class="link" href="https://linked365.blog/2020/02/23/incident-app-part-1/" target="_blank" rel="noopener"
>Part 1&lt;/a>)&lt;/li>
&lt;li>Data entry must be easy and not time-consuming (&lt;a class="link" href="https://linked365.blog/2020/02/23/incident-app-part-1/" target="_blank" rel="noopener"
>Part 1&lt;/a>)&lt;/li>
&lt;li>Weekly notification of all incidents to the welfare officer&lt;/li>
&lt;li>Email to parent or guardian of the diver when an incident is raised&lt;/li>
&lt;li>Escalation to welfare officer and others in the organisation for serious incidents&lt;/li>
&lt;li>Not cost anything&lt;/li>
&lt;/ul>
&lt;p>In this part I will walk you through the flows I used to notify parents and the welfare officer. There is also a requirement to escalate, notify immediately for serious incidents.&lt;/p>
&lt;h2 id="weekly-notification">Weekly Notification&lt;/h2>
&lt;p>To allow our welfare officer to monitor all incidents and any patterns, it was requested that they receive a weekly overview of all incidents raised that week.&lt;/p>
&lt;p>To do this, I created a flow using the recurrence trigger.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-10.png?w=619"
loading="lazy"
>&lt;/p>
&lt;p>Using these options, the flow will trigger at 3 am every Sunday morning.&lt;/p>
&lt;p>I then establish a variable for the email body and go off and retrieve all the items that have been created since last week. The filter query is used here to filter on all incidents that were created after 7 days ago, a simple addDays function used to get to the date 7 days ago&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-12.png?w=553"
loading="lazy"
>&lt;/p>
&lt;p>Next, just check to see if there are any incidents this week by checking the length of the returned list.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-13.png?w=552"
loading="lazy"
>&lt;/p>
&lt;p>If this is greater than 0, then incidents have been created, go on to create an email, if not, just do nothing.&lt;/p>
&lt;p>The next part is where I had to be a little bit clever, as the standard thing you would do did not give me enough flexibility. You could pass this list into a Create HTML function, but this put the data in a column format, where I wanted to display as a list going down the page, more of a normal email format.&lt;/p>
&lt;p>Instead, I built up an email, formatting the content as I went. Starting with an apply to each, taking the Get Items from SharePoint command. The first action I used repeatedly in the creation of the email, which is stripping the html content from html aware fields in the columns of the SharePoint. Leaving these in resulted in a lot of mangled emails.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-14.png?w=576"
loading="lazy"
>&lt;/p>
&lt;p>I then append to the Email Body string I created earlier a formatted HTML content.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-15.png?w=545"
loading="lazy"
>&lt;/p>
&lt;p>The incident date is a simple formatDateTime function useage&lt;/p>
&lt;p>formatDateTime(items(&amp;lsquo;Apply_to_each&amp;rsquo;)?[&amp;lsquo;IncidentDate&amp;rsquo;],&amp;lsquo;dd/MM/yyyy&amp;rsquo;)&lt;/p>
&lt;p>The next step is because Contacted field is a multi-choice option set. Again, I loop through the contents of the Contacted? field and append to the email body variable.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-16.png?w=571"
loading="lazy"
>&lt;/p>
&lt;p>The final parts of the loop finish of the content for each incident&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-17.png?w=554"
loading="lazy"
>&lt;/p>
&lt;p>Finally, send out the email. Subject details how many incidents in the week with a count from the SharePoint items returned.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-18.png?w=566"
loading="lazy"
>&lt;/p>
&lt;h2 id="email-the-parent--guardian">Email the Parent / Guardian&lt;/h2>
&lt;p>The next requirement was to notify the diver&amp;rsquo;s parent or guardian. For years, we had relied on slips of paper, which again is a GPDR nightmare. Using email was a sure fire way to ensure we have done our duty. This only applied for minor incidents, parents will certainly be involved a lot quicker for anything serious.&lt;/p>
&lt;p>Firstly, trigger when a new item is created in the SharePoint list&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-19.png?w=549"
loading="lazy"
>&lt;/p>
&lt;p>Next, get the diver that is indicated in the list, diver id being the linking record between the incident list &amp;amp; members&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-20.png?w=559"
loading="lazy"
>&lt;/p>
&lt;p>As this SharePoint get items call may return more than one item, we have to place in a Apply to Each&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-21.png?w=317"
loading="lazy"
>&lt;/p>
&lt;p>Check to see if the diver has an email address (if new divers come on board, this might not be the case until we have their full details).&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-22.png?w=768"
loading="lazy"
>&lt;/p>
&lt;p>If no email, stop the action, otherwise send an email to the email to notify the parent.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-23.png?w=547"
loading="lazy"
>&lt;/p>
&lt;h2 id="escalate-an-incident">Escalate an Incident&lt;/h2>
&lt;p>Most incidents, thankfully, require little follow up or after care. But, there are occasions that require our parent association to be notified along with insurance companies. We also have an internal follow up process for such incidents by our welfare officer.&lt;/p>
&lt;p>Rather than create a new flow, after the flow above, I continue. Does the Contacted multiple select option set contain Ambulance or Police, both mean an immediate escalation. This is done by looping through the options selected and updating a variable if one of them matches either of the 2 conditions.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-26.png?w=778"
loading="lazy"
>&lt;/p>
&lt;p>Further, there is a severe boolean on the form, so if that is triggered, also update the variable to true.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-27.png?w=666"
loading="lazy"
>&lt;/p>
&lt;p>Finally, if Severe has been set, send an email&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/03-image-28.png?w=696"
loading="lazy"
>&lt;/p></description></item><item><title>Incident App (Part 1)</title><link>https://linked365.blog/2020/02/23/incident-app-part-1/</link><pubDate>Sun, 23 Feb 2020 00:00:00 +0000</pubDate><guid>https://linked365.blog/2020/02/23/incident-app-part-1/</guid><description>&lt;img src="https://linked365.blog/images/2020/02-image-15.png" alt="Featured image of post Incident App (Part 1)" />&lt;p>Most of you won&amp;rsquo;t know this, but to keep me busy (as if work, blogging, presenting &amp;amp; community isn&amp;rsquo;t enough) I am the chair of my local platform diving club, Star Diving. Give them a look at &lt;a class="link" href="http://stardiving.org/" target="_blank" rel="noopener"
>http://stardiving.org/&lt;/a> if you or your son or daughter want to learn a great sport that pushes you to control your body &amp;amp; keep fit.&lt;/p>
&lt;p>My youngest son is part of the Skills squad (very proud parent) and he loves it. To support him and mainly because I was the last to step back, I became the chair of the club last April.&lt;/p>
&lt;p>Star is a registered charity, whose purpose is to promote diving across Surrey and beyond and have 200 members or all ages. As a registered charity, Microsoft generously gives Star 25 licenses for using Office 365, we host our email and use teams and other things.&lt;/p>
&lt;h2 id="the-requirement">The requirement&lt;/h2>
&lt;p>Diving is a dangerous sport to the untrained and accidents happen. Logging accidents and informing parents, in this day and age of GPDR has become a concern. Gone are the days that we can keep an accident book at the pool side and have a chat with a parent. Our duty of care needs to ensure any incidents are logged centrally to ensure repeat incidents.&lt;/p>
&lt;p>On discussing with our coaches and welfare officer a list of requirements where created. Wasn&amp;rsquo;t a formal list, just from conversations etc, but like any good BA, I created a list&lt;/p>
&lt;ul>
&lt;li>Centralised, secure list of incidents&lt;/li>
&lt;li>Ability to add divers to list for trials or competitions&lt;/li>
&lt;li>Data entry must be easy and not time-consuming&lt;/li>
&lt;li>Weekly notification of all incidents to the welfare officer&lt;/li>
&lt;li>Email to parent or guardian of the diver when an incident is raised&lt;/li>
&lt;li>Escalation to welfare officer and others in the organisation for serious incidents&lt;/li>
&lt;li>Not cost anything&lt;/li>
&lt;/ul>
&lt;p>Of all these requirements, the last one drove me in a direction which is not my normal. I am so used to firing up a CDS environment, creating an entity structure and starting the process from data.&lt;/p>
&lt;p>I decided to delve into the unknown (I know the principles, like any Solution Architect, but doing is different) and create a SharePoint list or two to store the data and build a Power App on top to handle data entry. Power Automate will be used to link the app together and provide the notifications.&lt;/p>
&lt;h2 id="introducing-pike">Introducing Pike&lt;/h2>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-15.png?w=430"
loading="lazy"
>&lt;/p>
&lt;p>Pike&amp;rsquo;s front screen has a series of buttons that I will hopefully expand on as I add functionality. I have used the default black and yellow scheme, as Star&amp;rsquo;s colours are the same.&lt;/p>
&lt;h2 id="data-entry">Data Entry&lt;/h2>
&lt;p>If you click on Create New Incident, you are taken to the first data entry screen.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-16.png?w=432"
loading="lazy"
>&lt;/p>
&lt;p>This is my first learning point. I knew what the * next to the fields means, but my users didn&amp;rsquo;t. Don&amp;rsquo;t assume that just because you know how something works that others will.&lt;/p>
&lt;p>This is a simple form based on the SharePoint list. The fields are formatted for the screen, and I didn&amp;rsquo;t want a lot of scrolling, so split the data entry over 2 screens. The first screen uses a second list for all our divers and displays a drop-down of them.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-17.png?w=419"
loading="lazy"
>&lt;/p>
&lt;p>Further, if the diver is not on the list, for trials or competitions, you can add them using the + next to the diver&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-18.png?w=406"
loading="lazy"
>&lt;/p>
&lt;p>The Reporter field is a Person or Group field in SharePoint, which allows linking to a user on our environment. Location is a choice field, with diving specific terms.&lt;/p>
&lt;p>Once all the fields that require data are filled in, a big Next button appears at the bottom&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-19.png?w=426"
loading="lazy"
>&lt;/p>
&lt;p>This is done by a simple formula on the Visible property of the button, namely, only display if the form is valid&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-20.png?w=558"
loading="lazy"
>&lt;/p>
&lt;p>Selecting the button passed to a second New form, to finish entering the data.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-21.png?w=392"
loading="lazy"
>&lt;/p>
&lt;p>The Contacted? field is a multi-choice field and it kicks off a flow for serious incidents (if a hospital visit or ambulance is called, it is serious by default)&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-22.png?w=404"
loading="lazy"
>&lt;/p>
&lt;p>Again, the visibility of the submit button is controlled by the validity of the form.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-23.png?w=431"
loading="lazy"
>&lt;/p>
&lt;p>The submit form doesn&amp;rsquo;t conduct a straight submit but combines the data on the two forms. Additionally, notify the user if there is a positive or negative outcome to the submission&lt;/p>
&lt;p>Patch(
Incidents,
Defaults(Incidents),
&amp;lsquo;frmIncidentNew-First&amp;rsquo;.Updates,
&amp;lsquo;frmIncidentNew-Second&amp;rsquo;.Updates, {&amp;lsquo;Welfare History&amp;rsquo;: &amp;ldquo;Created by &amp;quot; &amp;amp; User().FullName}
);
If(
IsEmpty(Errors(Incidents)),
Notify(
&amp;ldquo;Your incident has been recorded&amp;rdquo;,
NotificationType.Success
);
Navigate(
Home,
ScreenTransition.CoverRight
),
Notify(
&amp;ldquo;There was a problem submitting your incident. Please contact &lt;a class="link" href="mailto:incidents@stardiving.org" >incidents@stardiving.org&lt;/a> manually&amp;rdquo;,
NotificationType.Error
)
)&lt;/p>
&lt;p>This returns the user to the home screen, where they can view incidents they logged by clicking My Logged Incidents.&lt;/p>
&lt;h2 id="viewing-incidents">Viewing Incidents&lt;/h2>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-25.png?w=437"
loading="lazy"
>&lt;/p>
&lt;p>As you can see, I got bored in testing &amp;amp; documented a lot of gruesome accidents, which thankfully doesn&amp;rsquo;t happen.&lt;/p>
&lt;p>Clicking on the arrow shows the detail.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-27.png?w=415"
loading="lazy"
>&lt;/p>
&lt;p>For a normal coach, a reporter, this is the end of the functionality. But for our welfare officer and administrator, there are a couple of additional features.&lt;/p>
&lt;h2 id="securing-special-features">Securing Special features&lt;/h2>
&lt;p>On startup of the application, I run a Flow.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-28.png?w=918"
loading="lazy"
>&lt;/p>
&lt;p>This flow is checking to see if the logged in user is the owner of the team that owns the Incidents list.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-29.png?w=638"
loading="lazy"
>&lt;/p>
&lt;p>Firstly, initialise some variables, then call the SharePoint API to check the current users rights in the given SharePoint site.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-30.png?w=631"
loading="lazy"
>&lt;/p>
&lt;p>The variable in the Uri is passed in from the Power App, which is the users email address.&lt;/p>
&lt;p>If this call returns a value, it means that the user is in the owner team, and this result is passed back to the Power App.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-31.png?w=573"
loading="lazy"
>&lt;/p>
&lt;p>The isAdmin boolean is set after the call as shown previously.&lt;/p>
&lt;p>This global variable is used on the List of Incidents screen to hide or show an icon at the top&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-32.png?w=425"
loading="lazy"
>&lt;/p>
&lt;p>The visibility of this is controlled by the isAdmin value.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-33.png?w=372"
loading="lazy"
>&lt;/p>
&lt;p>This button toggles whether the user sees all the incidents or just their own. This allows an admin to view all incidents.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-34.png?w=443"
loading="lazy"
>&lt;/p>
&lt;p>On the incident detail screen, there is a edit button as well, which allows an admin or welfare officer to add some commentary to the incident, such as when the parent is contacted or details about any investigations.&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-35.png?w=427"
loading="lazy"
>&lt;/p>
&lt;h2 id="the-sharepoint-list">The SharePoint List&lt;/h2>
&lt;p>In SharePoint, you can see the recorded incident in the SharePoint list&lt;/p>
&lt;p>&lt;img src="https://linked365.blog/images/2020/02-image-36.png?w=1024"
loading="lazy"
>&lt;/p>
&lt;p>This is a simple use of the list, and is secure. Next article, I will walk-through the other flows that are being triggered to notify the parents and welfare officers to complete the requirements.&lt;/p>
&lt;h2 id="conclusions">Conclusions&lt;/h2>
&lt;p>It is a simple app, but it really hits the mark for being cheap (free), secure, easy &amp;amp; portable. SharePoint may not be the database of choice for everyone, but you can not knock it for being cheap. Power Apps just adds that extra polish to the data storage mechanism that takes it from a plain list to an intuitive application.&lt;/p>
&lt;p>If there are any clubs out there that want to work with me on implementing this app at your organisation, particularly charities, give me a shout. I would be happy to help &amp;amp; share the application and spend time installing with you.&lt;/p></description></item></channel></rss>