Named Formulas in Canvas Apps: CONSTANTS AREN'T VARIABLES
In this training video, Nate Halliwell from Pragmatic Works explains how developers and app builders can simplify their work by using named formulas in Canvas Apps. Historically, values that never change—such as a user’s email address, a manager’s details, or the current quarter—were stored as variables. But now, thanks to Microsoft’s named formulas feature, these can be handled more efficiently as constants.
Why Constants Matter
Nate begins by comparing constants in programming to values in apps that do not change during use. Examples include:
- User’s name or email address
- Manager’s name and email
- First day of the current month
- The current quarter of the year
Traditionally, Canvas Apps required storing these in variables through the OnStart property. However, constants make more sense since they do not vary.
Introduction to Named Formulas
Microsoft introduced named formulas about 18 months ago, but they were initially marked as experimental. Recently, they moved into the preview stage, making them stable enough for practical use. This update means app creators can now confidently use named formulas without worrying that the feature will be removed.
Enabling Named Formulas
To start using named formulas:
- Open Settings in your app.
- Navigate to Upcoming Features.
- Search for Named Formulas and enable it under the Preview tab.
Creating Named Formulas
Named formulas are created under the Formulas property of the app. The syntax is straightforward:
UserEmail = User().Email;
Nate emphasizes the importance of ending each formula with a semicolon, even if it’s the only formula present.
Using Named Formulas
Once created, these formulas are immediately available for use throughout the app, without requiring OnStart initialization. For example:
- User Email: Simply reference
UserEmailand it appears instantly in IntelliSense. - Manager: Defined as a record using
Office365Users.ManagerV2(User().Email), allowing access to fields like.DisplayNameand.Mail. - First Day of Month: Set as a constant using
DateValue()functions to dynamically calculate the first day of the current month. - Current Quarter: Calculated by dividing the month by three and rounding up, giving accurate quarterly values.
Working with Records and Tables
Named formulas aren’t limited to simple text or numbers. They can also hold:
- Records – such as a manager’s details
- Tables – for example, a manager’s direct reports
This flexibility makes them powerful tools for building scalable apps without cluttering the OnStart property.
Benefits of Named Formulas
- Eliminate unnecessary variables for static values
- Improve performance since no
OnStartexecution is required - Provide cleaner, more maintainable apps
- Allow reuse of constants across screens without duplication
Conclusion
Nate wraps up by highlighting how named formulas bridge the gap between traditional programming practices and Canvas Apps. Developers and app makers can finally declare constants, making applications easier to manage, more efficient, and less error-prone.
Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Canvas Apps and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up-to-date on the latest tips and tricks.
Sign-up now and get instant access
ABOUT THE AUTHOR
Nate Halliwell is a Power Platform enthusiast, specializing in Power Apps and Power Automate. He began his journey into the Power Platform as a “Citizen Developer” while working as a recruiter in talent acquisition. He used Pragmatic Works to train himself on the technology and hopes to use this new role as a trainer to help others achieve similar career transitions! Nate is PL-900 and PL-100 Certified, and ready to help you take on any Power Apps or Power Automate challenges you or your organization are currently facing! Outside of work, Nate is a husband, a father to 2 boys, and a beer league hockey player.
Free Community Plan
On-demand learning
Most Recent
private training

Leave a comment