Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Build a Teams Power App for Manufacturing 1: Get Started with Dataverse

0.00/5 (No votes)
9 Jun 2021 1  
This article is the first in our series that starts to create our server data control center using Dataverse within Teams.
Here we establish an app's beginnings, with a database to hold order and team member information and connectors to send email and Teams notifications.

This is the first article in a three-part series on Power Apps development in Teams.

Creating a Teams Power App is an easy way to build a minimum viable product (MVP) as a prototype. It saves us from writing too much boilerplate code, it doesn't need additional infrastructure to host a server, and non-developers can maintain it, such as the retail store owner.

Introduction

You may be a little skeptical about low-code and no-code application development. As a traditional software developer, you don't want to be out of a job, but all the buzz on the development circuit may make you curious. So, dive right in with us and discover how low-code and no-code applications help professional developers like you.

Since the pandemic began, many of us have become increasingly reliant on Microsoft Teams. It has everything we need to work effectively with our remote colleagues. Given that 86 percent of the Fortune 500 are using Microsoft Power Apps, it's natural to integrate the two. The promise of quickly making powerful apps that add additional functionality to Teams, at a fraction of the speed of normal development, all without having to leave the comfort of Teams, is appealing.

Over the course of three articles, we'll share our experience of building a Power App for Teams, with a how-to guide to help you start building your first Teams Power App. This comes with a warning, though — once you get started, it's pretty addictive!

The Scenario: An HVAC Ordering System

We'll build an example app to help a heating, ventilation, and air conditioning (HVAC) manufacturer quickly and easily accept new orders. Many manufacturers still have a manual ordering process. For example, someone filling out a spreadsheet and sending it to a sales representative, who then has to enter the data into an internal software system. This duplicates work when employees could be using their time for more productive tasks, like checking in with customers and bringing in new business.

Our app incorporates an approval system, and although there are tools such as Power Automate, we'll use only Power Apps in Teams. The app enables employees at customer companies to order products from the manufacturer. Managers at the customer company then review requests and approve or decline them, then group the approved requests and submit them to the manufacturer.

Employees at the manufacturer's location then view the orders and send each to the appropriate department for approval.

We'll use Microsoft's Dataverse, formerly known as Common Data Service, for our application's database. Power Apps for Teams can also integrate with hundreds of other data sources and connectors.

Create a Power App in Teams

Before we begin, open Teams, select the ellipses on the left bar, search, and select Power App. Once installed, click the Power App icon and pin it. The pop-out feature enables you to use Teams while developing your app.

Select the Team and Name the App

Next, in Power Apps, select the team that should have access to your new app and name it.

This process takes time while Power Apps creates the server database provision called Dataverse, which stores and saves our data. Once this process is complete, Power Apps opens the Power Apps Studio in Teams.

Add Some Data

For our app, we want customers to be able to place an order, which is either rejected by their manager or approved, grouped, and submitted to the manufacturer. The manufacturer then views the orders and sends them to the appropriate department for approval.

We must create five tables for data. The first holds information about products that customers can buy.

Field Name Data Type
ProductName Text
Description Text
Price Decimal (Max decimal places: 2 Minimum Value: 0)

In Power Apps, select Add Data and create a new table. Call it HVAC_Products.

It's worth taking a little time to explore all the data types available here. We're keeping this app relatively basic, but you may use more advanced field types. For example, you could add stock levels and supplier information. The possibilities are endless. You should check out the Northwind Traders database for inspiration.

Our field names don't contain spaces, although this is more out of habit than necessity as Dataverse can cope with spaces. You must wrap the fields in single quotes when referencing them if you choose to have spaces in the names.

Fill the HVAC_Products table with a small amount of data. It makes creating the app easier to have some records already there.

Tip: Dataverse creates extra fields behind the scenes, such as "Created By" and "Modified B." It's worth being aware of these for your future app development. A complete list of these fields, and different data types for your fields, are available in the solution explorer within Teams.

Select Home. Select See More from within the Recent apps section. Select the Team where your table resides, then select See all.

Select Tables and look at the options available to you.

The next table must keep track of orders. It acts as the parent to the following table (HVAC_Order_Details). Call the table HVAC_Orders.

Make a new table with the following properties:

Field Name Data Type
CustomerName Text
Total Decimal (Max decimal places: 2, Minimum Value: 0)
OrderStatus Choice:
  • Awaiting Approval
  • Approved
  • Rejected
  • Ready for Processing
OrderID AutoNumber

Now create the child table, HVAC_Ordered_Items.

This table stores each ordered product, mapping it to the parent table (HVAC_Orders) using the OrderID field.

Make a new table with the following properties:

Field Name Data Type
CustomerName Text
OrderID Text
ProductName Text
Quantity Number
Subtotal Decimal (Max decimal places: 2, Minimum Value: 0)

Last, we need two more tables. These contain information about the managers who have permission to approve customer orders and the manufacturer's employees who need access to orders ready for processing. We'll use these tables as a kind of authentication layer within our app.

Create the HVAC_Managers table with these properties:

Field Name Data Type
Name Text
Email Email

Create the HVAC_Manufacturers table with these properties:

Field Name Data Type
Name Text
Email Email

Let's also add two connectors called Microsoft Teams and Office 365 Outlook to unlock some features. These tables enable posting to a Teams Channel and sending an email, respectively.

You add connectors in a similar way to adding a table. Select the Data tab on the left bar, then select Connectors.

Add the Microsoft Teams and Office 365 Outlook connectors.

Note that to use these connectors, each of them requires you to authorize Power Apps.

Once the connectors are authorized, return to the Data tab and add Office365 Outlook and Microsoft Teams as connections.

It's worth noting that Microsoft recommends limiting your data sources to thirty per app to keep performance at its peak. Each connector requires authentication when an app starts and for data requests. Each connector demands extra memory, bandwidth, and CPU resources.

Summary

We finished setting up our server. Pretty easy so far! You now have an app's beginnings, with a database to hold order and team member information and connectors to send email and Teams notifications.

In the following article, we'll create our app, focusing on the customer user interface. Customers will be able to view the manufacturer's products and parts, add them to their shopping basket, and submit their order for their manager's approval.

Check out our 7-Step Guide to Low-Code App Development to get starting using Power Apps today.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here