Sunday, 19 January 2020

Power Apps Quick Tips

Some of my Power Apps notes:

Determine your Power Apps licence using Power Apps Web user interface:
Power Apps > Settings > Plans

Note:  Microsoft changed how Power Apps licencing works circa Nov 2019.  The Power Apps licence with O365 E3/E5 does not have the connectors so is useful only for simple apps, and using flow, the apps can get more advanced.

I saw a preview of the Power Apps Test Framework as the Microsoft Ignite Tour in mid Jan 2020.  The framework allows for recording UI tests and inserting asserts.  The tests are stored alongside the project inside Power Apps.  PowerApps Testing is in beta, it will be release by region so presumably it's already available in some US regions on the public beta.  The CI/CD pipeline integration was not shown but I'm sure some smart fella will look at this shortly.  I'd use Selenium for automated web testing at this stage, but that may change especially for mobile app development.

Updated 28 Jan 2020: Test Studio for Power Apps released today.  Here is the announcement.  Here is another recording outlining testing of Power Apps.

In the Power App > File > Settings > Advanced Settings > Scroll down to "Formula-level Error Management" and turn on the feature.
Open the "Advanced tools"
Accessing Test Studio in Power Apps

Power Apps Development Standards:
Error Handling - Should an unexpected event occur, log so the issue can be traced, as of 3 Feb 2020, PowerApps has App Insight integration.
Naming standards - Label visual controls and variables
Approved Colours - Digital branding standards
Reuse - Control reuse with shared branding
Roles - AAD connector allows me to figure out the user group the current user belowngs too so they get approriate menus, screens, and actions.
Menus -  @Laura-GB  Build a menu component, input allows one to combine with AAD roles to create dynamic menus for users.
Copy and pasting OOB controls - such as a textbox, if you use a formula, the vlaues are persist and passed around.  So if you have a color set by a variable, copy and paste results in the new text box referencing the colour.  Taking this further, if you put in the position X and Y a formula e.g. X=66*1 and Y=100*1, the control will inherit the parent controls property rather than reset the property.

Steps to setup and Use a Custom Connector:

Get the http response from a custom connector and add to a collection
Common Functions:
DateTimeValue() - Convert string into a date
Text() - Format a string
Value()- Format a string into a numeric
Text(DateTimeValue(TextInput1.Text), "dd-mmm-yyyy")
An approach I like to advanced Power App Input Validation.
Lookup() - Finds the first record in a table, closely related to Filter() and Search()

Error Handling and Logging:
PowerApps has pretty basic error handling IfError(Try, if fail fall back)
Error Handling for Power Apps
The is a built in mechanism to log from Power Apps into App Insights.

Build a common UI element such as a menu or header.  The component has input and output parameters so you need to pass in the data to be used and return the output.  This allow the component to be re-used.  Obviously it makes sense that you can't use global variable within components, you need to pass the global variables in using input parameters.
Great example from @Laura-GB


Post a comment