Power Platform and AI – Part 1: Power Apps
In the last 12 months, it has been impossible to avoid hearing about AI and how chatGPT is revolutionizing everything. Microsoft is strongly involved in the development and has released artificial intelligence-based assistants (copilot) in its products at a breathtaking pace.
Some of the new AI applications seem really useful and I believe that they will change the way work is done and the contents of job roles. Some of the announcements look more like they just wanted the AI stamp on the product quickly.
In which camp do Power Platform’s AI capabilities fall? This two part article aims to give you a honest walkthrough of the AI powered features available as of November 2023. The first part focuses on Power Apps, in part 2 I’ll explore Power Automate.
The app related features in this article will cover:
- AI for app development:
- Power Apps Ideas
- Generating Power Fx with natural language
- Copilot in Power Apps
- Creating Power Apps using natural language
- Creating a Dataverse table with AI
- AI for app users:
- AI Builder
- Copilot control
AI for Canvas Power Apps development
This is probably Power Platform’s first AI-based assistant. You can select the text field in the gallery (1) and on the ideas tab (2) give an example of how you want to format the value of the field (3).
The assistant suggests a formula to reach the final result (4). The proposal can be activated if seems to fine (5).
The assistant creates a formula for us in the blink of an eye, which shows the first three characters of the account name in capital letters.
Upper(Left(ThisItem.'Account Name', 3))
Handy if you are not familiar with PowerFx. Or if the required formula is so difficult that you just can’t write it.
However, another example reveals the other side of the coin.
We want to format the date displayed in the gallery in a more familiar format. The example we use is “16.8. 2023”.
The formula suggested by AI is the following.
Text(Day(ThisItem.'Created On'), "0.0", "en-GB") & Text(ThisItem.'Created On', "m", "en-GB") & ". " & Text(ThisItem.'Created On', "yyyy", "en-GB")
Hmmm. Sounds a bit complicated? True. The same end result can be reached much easier.
Text(ThisItem.'Created On', "dd.m yyyy", "en-GB")
The next one also produces almost the same.
Text(ThisItem.'Created On', DateTimeFormat.ShortDate, "Fi-fi")
AI generated Power Fx formulas (usually) work, but they can be unnecessarily complex. They are not optimal in terms of performance. More importantly, they can be difficult to read. Even so difficult that the creator of the application does not understand at all what the formula does. It just produces the desired result. At least with a few examples we have.
Is it reasonable to use the formula in the application? I think not.
For now, the ideas only work within a single table. You can’t format information found behind the LookUp field, such as the name of the creator of row.
Generating Power Fx with natural language
According to Microsoft Learn, for example, gallery filters can be built using natural language.
I have yet to see this feature in any environment.
Copilot in Power Apps
Power Apps has its own Copilot, who can be asked to make small changes to the application.
For example, the request “add form for modifying accounts” creates for us an (empty) form connected to the Accounts table.
What about adding fields to a newly created form? It is yet too difficult for the copilot.
Let’s ask the copilot to add a button to the screen that submits the form (SubmitForm).
The button is created, but the formula still goes wrong. I had written the name of the form in the command with a small initial letter (form1). The name of the form should have been written exactly correctly (Form1) and it would have worked.
The characteristics of the individual control can be changed using the copilot. Like “Set selected label color to black”.
Let’s try something a little more complicated.
Set selected label color to red if value starts with "A" and blue if value starts with "C" and green if value starts with "B"
All titles turned green even though the attempt was to change the color based on the first letter.
It seems that copilot is able to add individual controls to the screen, as well as change their individual values. It is not yet able to produce operational logic.
Creating Power Apps using natural language
Power Apps can also be created completely from scratch using natural language. Let’s try it.
We are creating an application where you can review the movies you have watched. Let’s use the following as a prompt.
Create app for rating movies. For each movie store name, year, rating (1-5 star), director and genre
The assistant first outlines the table where the reviews are collected. It can even create sample content for it. Impressive.
The style is a text column. Ask the assistant to change it to choice.
Change genre column to be choice. Values are Crime, Drama, Action, Comedy, Family, Horror, Scifi, Magna and Animation
And that’s what it does.
You shouldn’t get greedy at this point. For the time being, the feature can be used to create an application that uses a single table in the background. Don’t ask it to create a genre in its own table and create a relation between these two tables. It can’t.
Let’s continue by creating an application based on the defined table (Create App).
After a short thought, we have a neat looking responsive application that you can use to enter movie reviews.
Let’s continue with the details with the copilot. Let’s ask it to change the title bar text to orange.
After several attempts, it finally worked! In practice, the copilot had to be told the name of the control to be edited. Unfortunately, even tablenamelabel1 was not enough. The control had to be told in the form TableNameLabel1.
Copilot’s problems are the same as in our previous example. I can’t think of practically any sensible task that it can do for me.
Creating a Dataverse table with AI
You can also use copilot when creating a single table.
And then just ask what you want on the table.
For the puritans, all tables created in this way get the default prefix of the environment.
AI for app users
So far, we’ve covered the AI features of Power Apps that make it easier to make an app. Finally, let’s check how different AI capabilities can be utilized inside the application.
We can take advantage of AI Builder’s different models with ready-made controls (or make our own).
The Internet is full of examples of how you can use ChatGPT in Power Apps. Either a public service or your very own from Azure.
An excellent tool if you need to generate text in your application, for example, or extract content from free-form text to pass on.
I haven’t been able to try this myself yet. You can add an assistant to the application, to whom end users can freely ask questions.
The catch is that the copilot control is bound to a single Dataverse board. It can answer questions related to the data contained in the table.
Are these AI features of Power Apps completely useless?
They will help a citizen developer who is making her/his first applications.
As an experienced Power Apps developer, will I benefit from them?
I don’t. Yet.
But I don’t believe for a second that, for example, Power Apps’ copilot would stop evolving. A year from now, it will be significantly more capable for sure. And maybe I already have it in daily use.
Check out part 2 of the article to understand the AI features available in Power Automate for cloud flow makers.