Click here to Skip to main content
15,173,154 members
Articles / Productivity Apps and Services / Microsoft Office / Microsoft Office 365
Article
Posted 29 Jul 2021

Stats

2.1K views
2 bookmarked

Building a Teams Power App Using a Custom Connector Part 3: Editing Data and Writing Back to the App

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
29 Jul 2021CPOL7 min read
In this article we learn how to edit data in your Power App and write it back to the app, helping your organization’s teams quickly and easily manage events with consistent information.
Here display the meeting information from Meetup.com to users in our Teams group, enable them to rate the meetings, and update that information.

This article is a sponsored article. Articles such as these are intended to provide you with information on products and services that we consider useful and of value to developers

This third and final article in our Teams + Power Apps series improves our Teams Power App. In the first article, we created a simple Power App in Teams and connected it to a table with manually inputted data. In the second article, we wrote a Power Automate Flow to pull a list of meetings from Meetup.com into our Teams app.

So far, our Teams Power App tracks meetings from the .NET Foundation’s meetup site. The app pulls future meeting data into our Teams Dataverse and into the MeetingLists table. It then displays meeting information to our Teams users, like this:

Image 1

In this article, we’ll modify the Power App to add meeting ratings, then return that rating information. We’ll also clean up the original meeting app’s display and add a few tricks.

Enhancing the Power App

To enhance our Power App, we’ll now add a rating field to the MeetingList table. It will get this rating from another table.

We’ll start by adding a "Rating" field and cleaning up the original table display. To add a table field using the Power App editor in Teams, we go to the data icon, click MeetingLists, click the ellipsis to display the popup menu, and select Edit data.

Image 2

Next, we click + Add column and make a new Number field with a range of 0 to 5.

Image 3

Next, we add a new table, MeetingRatings. This table has fields to name the rating, identify the meeting in MeetingLists, provide a numerical rating, and write a comment. In the data area, we click + Add data at the top, then Create new table.

Image 4

We now create a new table and name it "MeetingRatings."

Image 5

When we create a table, it adds a required Name field which we cannot delete. We can rename it, however, and we’ll use it to contain a title for the rating. We rename the column by clicking the down arrow to the right of where the column name is currently "Name":

Image 6

We can use the plus sign to the right to create more columns, or we can click + Add Column at the top. We do this to add the following columns:

  • "Meetup" of type lookup with lookup "Meetings List"
  • "Rating" of type number with a range from 0 to 5 (see advanced options)
  • "Comment" of type text with a length of 1,000

Our table looks like this:

Image 7

Now we can go back to the data icon, see the table, right-click to Edit Data, and add a row of data. For example, when we click on the Meetup field, it displays a list of meetings. Note there can be a short delay while the app fetches the list.

We’ve added a row for the demo:

Image 8

Next, we add a new blank screen and rename it "Ratings." However, we can rename it and click on the blank canvas to add data and select the MeetingRatings table. Optionally, we can add additional formatting.

Note that Power Apps doesn’t add the Meetup field automatically. We need to edit the form and add that field.

Image 9

Now we can save the form and preview it. We can click the one record we have to see the rating or add a new record.

Image 10

Also, note that the rating must be an integer.

We can edit the record by clicking the pencil icon in the upper right corner. If, for example, we enter an illegal value for a rating, automatic validation gives us an error message, and we will not be able to save the record (by clicking the checkmark icon in the upper right corner).

Image 11

Note that the Power App website offers some additional functions to the Teams Power App. For example, we can delete a table. To open the Power Automate website, click Power Automate in Teams and click the small globe icon in the upper right corner.

Also note, we should check that we are in the right environment (displayed on the upper right side). If we click on the team name, we may see multiple environments. The correct environment has the same name as the team where we are creating the Power App.

For example, if we remove a table from Power Automate, we still have to remove it from the data section of our Power App.

Creating an Update Rating Flow

Next, we’ll bring it all together by making a new flow that updates the ratings and writes them to the meetings table. We’ll use a simple flow that assumes one rating per meeting to avoid more complicated loops and fetch XML aggregates.

First, we go to our flows, click + New flow, and select Automated cloud flow. We’ll get a Build an automated cloud flow dialog box. Name it something like "Meeting Rating Updater."

For a trigger, we search for "Dataverse" and select When a row is added, modified or deleted, then click Create. If you have problems getting the flow to work, you can use a manual trigger to shorten the debug cycle.

Image 12

For now, we’ll only set the trigger’s required fields for simplicity. We can also filter by a specific column. Let’s set ours up to create, update, or delete a row in the MeetingRatings table.

Image 13

To keep this simple, and because we only have one rating per meeting at this point, we’ll go through the MeetingRatings table and update the corresponding meeting in MeetingLists. It would be more appropriate to collect all the ratings for an event then calculate an average. However, aggregates are a more complex Power Automate Flow task, and it’s beyond the scope of this article.

Image 14

Finally, we’ll loop through all the meeting ratings and update the corresponding meetings list entry. The previous step passes a list of ratings as the value. We identify MeetingLists as the table and Meetup (Value) as the Row ID. In Dataverse, unique identifiers and GUIDs are primary keys.

Image 15

Note that we rename each step to make a bit more sense.

Now we can save the flow and automatically run the Flow Checker to display any errors or warnings. Flow Checker does suggest adding a filter on Get Meeting Ratings to limit the rows as we would do in any usual database project. We skip that step here for simplicity.

Testing the Rating Function

At this point, we can test our new app function by editing a row in the MeetingRatings table. We can use automatic, too. It uses a recent trigger. Here, we update both rows in the MeetingRatings table, then monitor the flow to ensure it runs successfully.

To do this, we click data, open the MeetingsRatings table, and click Edit data using the default view. We also add the Rating column to the default view so we can easily modify the rating column.

Image 16

We change the ratings to 1 and 2, respectively, and monitor the flow. After a few minutes, the trigger should kick in and report: "Succeeded." Note that you may require a few iterations of this, as you can see below:

Image 17

When we click on the Start column in any row, Power Automate displays the run results and provides more information to fix issues, if required.

Next, when we look at the default view of the MeetingLists table (with the added Rating column), we can see that the ratings are updated.

Image 18

Now we can publish the MeetingRatings app into our Teams team and change a rating there. Then, we can open the MeetingList app and, after a few minutes, see the results of those changes.

Summary

In this article series, we created a simple Teams Power Apps tool to read meeting information from Meetup.com, display that information to users in our Teams group, enable them to rate the meetings, and update that information. Our organization’s group members can now more easily manage meeting information in the same location as their other productivity tools.

Power Apps and Power Automate in Microsoft Teams bring a vast array of possibilities to a domain expert using no-code tools to write applications and make them available to everyone on the team. These tools are evolving with frequent improvements and enhancements to enable Teams users to create and use a wider variety of features.

Throughout this article series, we have explored just how easy it is to create helpful productivity tools in Teams. You can expand on our simple app with your own enhancements or create something brand new to help your team or other users boost their productivity. Learn more about Power Apps for Teams and start building your unique app today.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

DaveNoderer
CEO Computer Ways, Inc.
United States United States
Developer, MVP Reconnect and community activist in South Florida.

Comments and Discussions

 
-- There are no messages in this forum --