Reader small image

You're reading from  Learn Microsoft Power Apps - Second Edition

Product typeBook
Published inSep 2023
PublisherPackt
ISBN-139781801070645
Edition2nd Edition
Right arrow
Authors (2):
Matthew Weston
Matthew Weston
author image
Matthew Weston

Matthew is a Microsoft 365 & SharePoint specialist from the Midlands in the United Kingdom. He has spent several years working in various Consultancy roles. Matthew is the Managing Director of Vantage 365, which fuels his love of working on projects surrounding Microsoft 365, especially those that involve SharePoint, Microsoft Teams, Power Apps, and Power Automate. This could be helping businesses find solutions for their problems or offering training to help people use these technologies better. Matthew leads the Black Country Power Apps & Power Automate user group, and the Office 365 & SharePoint User Group in the West Midlands. Matt is a Microsoft Most Valuable Professional in the field of Business Applications.
Read more about Matthew Weston

Elisa Bárcena Martín
Elisa Bárcena Martín
author image
Elisa Bárcena Martín

Elisa Bárcena Martín is currently a project leader at LogiRAIL, having previously worked as a business apps specialist at Intelequia and a project analyst at GlaxoSmithKline. As a Power Platform enthusiast with more than 3 years of experience with the Power Platform, she has steadily grown from her initial role as a developer into her project leader position. She is a scientist and teacher by vocation, loving process optimization and believing in continuous improvement and learning.
Read more about Elisa Bárcena Martín

View More author details
Right arrow

Using Power Automate with Power Apps

Power Apps allows us to develop a huge amount of logic directly within an app, but this logic is limited to frontend processing rather than heavier processing. In the past, this would have been done with server-side code, but in Power Apps, we can offload this type of processing to Microsoft Power Automate, the Microsoft 365-based automation platform.

Microsoft Power Automate was previously known as Microsoft Flow and was changed in November 2019. While the application has changed names, the individual workflows are still known as flows. Therefore, when we talk about the service, we refer to Power Automate, whereas when we discuss individual processes, we will refer to a cloud flow.

Using Power Automate alongside Power Apps allows you to unlock the door to almost limitless levels of functionality and interoperability with other services. It allows you to integrate not only with Microsoft services, but with other third-party...

Technical requirements

To follow along with this chapter, you will need the following:

  • A Microsoft Power Automate license, which can be attained by getting a Microsoft 365/Dynamics 365 seeded license, a per-user license, or a per-app license
  • A Bing Maps API key (previously used in Chapter 10, Using GPS in Power Apps)

Understanding flows

Microsoft Power Automate is part of the Power Platform and serves as the automation platform within Microsoft 365. Power Automate, unlike SharePoint Designer workflows or Workflow Server, is completely browser-based and also accessible through the Microsoft Power Automate mobile app, which is available for both iOS and Android devices.

The purpose of the platform, just like Power Apps, is to provide a no-code or low-code environment where you can create automated processes in a graphical way. Automated processes allow you to take your manual repetitive tasks and hand them over to an automation to allow you to spend more time on tasks that add value. Such things could be automated reminders, document generation, or even management of an entire process. An example of a cloud flow is shown in the following screenshot:

Graphical user interface, text, application  Description automatically generated

Figure 14.1: Microsoft Power Automate in a browser

Power Automate is built upon the same foundation as Azure Logic Apps, but the key...

Creating flows through the Power Automate service

To access Power Automate, we can either navigate directly to https://make.powerautomate.com or we can launch it from the Microsoft 365 portal (portal.office.com), which allows us to select Power Automate from the list of available applications.

Once we have navigated to Power Automate, we have a variety of options available so that we can get started. These options are quite similar to those that are available for Power Apps since we can either start from a template, which has a number of preconfigured actions that we can then modify, or start from scratch, where we have a completely blank canvas on which to build the cloud flow as we see fit.

The first option we will look at is creating a cloud flow from one of the existing templates.

Creating a cloud flow from templates

If you are new to Power Automate, then there are a number of templates covering a vast array of scenarios, all of which can be accessed from the Templates...

Feedback

We are constantly looking at improving our content, so what could be better than listening to what you as a reader have to say? Your feedback is important to us and we will do our best to incorporate it. Could you take two mins to fill out the feedback form for this book and let us know what your thoughts are about it? Here's the link: https://forms.office.com/r/STtMpJAhFS.

Thank you in advance.

In the previous chapters, we discovered how to use controls, connectors, and data sources to work with data. All of this, however, has been dependent on a network connection, Wi- Fi, or mobile to be able to push and pull data. Given that Power Apps is intended to be used on a mobile device, we all know that having a consistent data connection cannot always be guaranteed.

For us to mitigate potential issues with network dropouts, Power Apps allows us to cache data locally, which means that we can continue to work without interruption if we lose the connection to our data source. In...

Technical requirements

To follow along with this chapter, it is recommended that you have completed the previous labs to build our example app. You will also need to have a mobile device with Power Apps installed to test the functionality we are exploring within this chapter.

Detecting a connection state

One of the key things for making your Power App available offline is the ability to detect whether a network is present or not. First of all, Power Apps can detect the presence of a connection signal using a function that can then be used within the logic of your app:

Connection.Connected

This function will return a Boolean value: true meaning it is connected and false meaning it is disconnected.

Power Apps can also determine whether the connection is based on the cellular connection of the device or whether it is using Wi-Fi. If the device is using a mobile network, then it is classed as a Metered connection:

Connection.Metered

Again, this returns a Boolean value: true for a metered network or false for an alternative connection.

Both of these connection states should be considered while developing your app, as you can change the behavior of the app depending on whether the app is online or offline, and you can change the behavior of the app depending...

Working with local data

One of the key abilities that we need to build into our app to allow us to go offline is to store data locally and then retrieve it again. This is achieved by using the functions of SaveData and LoadData.

It is key to understand what it means to you as a developer, and to your users, where your data is being stored when it is taken offline; therefore, we will now focus on the following:

  • Saving data locally
  • Loading data from the locally stored data file

Let's see how the first part goes.

Saving data locally

Before we can load data, we, first of all, need to save it by using the SaveData function. This will securely save our collection of data to an area that is local to the device being used. We are obviously in a world where data security is paramount. In the previous chapter, we discussed securing parts of our app so that users can't access data that they shouldn't and the same concept applies to our offline data.

Power Apps has excelled in this...

Implementing offline capability

Now that we have discussed the component parts of building offline capability, we will look at the overall process to determine how and when each of the various functions should be used.

The process will look at how and when we interact with the master source of data, most notably with the on-start properties to ensure that we are loading the correct data at the point that the app is launched. We will then look at how we can work offline, followed by the handling of data when the app comes back online. To achieve this, we need to consider the following:

  • Implementing the on-start process
  • Working offline
  • Synchronizing data between the online and offline data stores

The first element to consider is how we interact with the data and load the data from the correct place to start building the offline capability.

Implementing the on-start process

The most important part of working offline is that we need to start preparing for it from the point that the app...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Learn Microsoft Power Apps - Second Edition
Published in: Sep 2023Publisher: PacktISBN-13: 9781801070645
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime

Authors (2)

author image
Matthew Weston

Matthew is a Microsoft 365 & SharePoint specialist from the Midlands in the United Kingdom. He has spent several years working in various Consultancy roles. Matthew is the Managing Director of Vantage 365, which fuels his love of working on projects surrounding Microsoft 365, especially those that involve SharePoint, Microsoft Teams, Power Apps, and Power Automate. This could be helping businesses find solutions for their problems or offering training to help people use these technologies better. Matthew leads the Black Country Power Apps & Power Automate user group, and the Office 365 & SharePoint User Group in the West Midlands. Matt is a Microsoft Most Valuable Professional in the field of Business Applications.
Read more about Matthew Weston

author image
Elisa Bárcena Martín

Elisa Bárcena Martín is currently a project leader at LogiRAIL, having previously worked as a business apps specialist at Intelequia and a project analyst at GlaxoSmithKline. As a Power Platform enthusiast with more than 3 years of experience with the Power Platform, she has steadily grown from her initial role as a developer into her project leader position. She is a scientist and teacher by vocation, loving process optimization and believing in continuous improvement and learning.
Read more about Elisa Bárcena Martín