Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Microsoft Power Apps Cookbook

You're reading from   Microsoft Power Apps Cookbook Become a pro Power Apps maker by applying practical use cases to solve ever-evolving business challenges

Arrow left icon
Product type Paperback
Published in Jan 2021
Publisher Packt
ISBN-13 9781800569553
Length 376 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Eickhel Mendoza Eickhel Mendoza
Author Profile Icon Eickhel Mendoza
Eickhel Mendoza
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Chapter 1: Building pixel-perfect solutions with Canvas Power Apps 2. Chapter 2: Building from data with model-driven apps FREE CHAPTER 3. Chapter 3: Choosing the right data source for your applications 4. Chapter 4: Automating processes with Power Automate 5. Chapter 5: Extending the Platform 6. Chapter 6: Improving User Experience 7. Chapter 7: Power Apps Everywhere 8. Chapter 8: Empowering your applications with no code Artificial Intelligence 9. Chapter 9: Discovering the Power Platform admin center 10. Chapter 10: Tips, Tricks, and Troubleshooting 11. Chapter 11: Advanced Techniques with Power Apps Component Framework 12. Other Books You May Enjoy

Setting up business process logic

For every business process, there is always a step-by-step procedure that defines every requirement, objective, and resolution from start to end. Companies build on and improve these procedures depending on the business needs, and they even create departments to work exclusively on this.

Explanation and overview

Model-driven apps help set up these rules by providing several tools to define business logic on various platform levels. You can incorporate data validation rules and structured data flows to guide the end user, and even trigger workflows for defined events on your processes. These are just some examples of what you can achieve with this platform.

Let's improve our help desk app by adding business logic to the solution we created in the previous recipe:

  • Hide or make a column visible depending on the status of a ticket using a business rule. In our case, there is no reason to have the Customer Validation column visible unless the case is in the Resolved state.
  • Guide the ticket processing by making sure the user inputs the required information on each defined step with the help of a business process flow (BPF). This component also allows you to execute processes, Power Automate cloud flows, or workflows when a defined trigger gets fired.

How to do it…

  1. First, open the help desk solution, and let's start by adding data validation rules to the Tickets table. Select the table and then click on Edit.
  2. Go to the Business rules tab, and on the toolbar, click on Add business rule; this will open a designer where you can define actions based on a condition.
  3. Select the default condition, New condition, and on the right panel, set these properties:

    Display Name: Customer validation visibility

    Under Rules, set to check when Ticket Status equals Resolved or Closed, and then click on Apply.

  4. Click on Add on the main toolbar to include an Add Set Visibility action. Once you choose this option, two plus signs will appear next to the condition, when it is valid (checkmark) and another when it isn't (X). Place one on the checkmark and then add another for the X.
  5. Select each new action and set the following properties on the right pane, and then click on Apply:
    • Condition is met:

      Display Name: Show Customer Validation

      Field: Customer Validation

      Visible: Yes

    • Condition isn't met:

      Display Name: Hide Customer Validation

      Field: Customer Validation

      Visible: No

  6. Finally, click on Ticket: New business rule, located at the upper left of the screen, to set the business rule's name. Enter Customer validation visibility and then hit Save on the toolbar, and then on Activate to make it available for this table:
    Figure 2.13 – Customer validation business rule

    Figure 2.13 – Customer validation business rule

  7. Now, let's create a BPF to guide our users during the ticket processing:
    • From your solution, click on the ellipsis on the toolbar and select Switch to classic. This process still requires the classic interface to use the proper solution prefix for the BPF.
    • Once the classic solution designer opens, click on Processes on the left pane and then click New in the toolbar; this will open a new dialog to gather properties for your BPF. Set the following values for the Ticket table and click OK:
Figure 2.14 – New BPF dialog

Figure 2.14 – New BPF dialog

  1. Once the designer opens, you will find a default stage. These are the steps of your guided flow. Let's create three more stages by dragging them next to each other from the components panel. Click on each one and set Display Name to the following: New, In Progress, Resolved, and Closed. For each one, click on Apply afterward.
  2. Each stage comes with a data step by default, which lets us specify the column that gets displayed in each step of our BPF, as well as, most importantly, which ones are required when moving from one stage to the other. Let's configure the data steps for each stage by clicking on Details and setting these values:
    • New:

      Data Field: Description

    • In Progress:

      Data Field: Description – Required

    • Resolved:

      Data Field: Resolution – Required

    • Closed:

      Data Field: Customer validation – Required

  3. After completing these changes, on the top toolbar, click on Validate to check everything is correct, and then click Save. Finally, click on Activate to enable this BPF.

How it works…

Once we have configured the business process logic for Tickets, every time this table gets invoked, it will carry on these defined components. To see them working, go to your solution, select the model-driven app, and click on Play; this will open the app on the Pending Tickets view. Click on New to add a ticket.

You will see that the form now includes your BPF, which lets you have a clear visualization of which step of the process your ticket is. After saving it, if you try to move beyond the Resolved stage, it will ask you to set the value for the required columns:

Figure 2.15 – BPF in action

Figure 2.15 – BPF in action

As for the business rule, the Customer Validation column will remain hidden until the ticket status gets changed to Resolved. Once we enter this column's data, it is then that we can finish the BPF:

Figure 2.16 – Ticket processing completed

Figure 2.16 – Ticket processing completed

You have been reading a chapter from
Microsoft Power Apps Cookbook
Published in: Jan 2021
Publisher: Packt
ISBN-13: 9781800569553
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.
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 €18.99/month. Cancel anytime