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.
Nate begins by comparing constants in programming to values in apps that do not change during use. Examples include:
Traditionally, Canvas Apps required storing these in variables through the OnStart property. However, constants make more sense since they do not vary.
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.
To start using 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.
Once created, these formulas are immediately available for use throughout the app, without requiring OnStart initialization. For example:
UserEmail and it appears instantly in IntelliSense.Office365Users.ManagerV2(User().Email), allowing access to fields like .DisplayName and .Mail.DateValue() functions to dynamically calculate the first day of the current month.Named formulas aren’t limited to simple text or numbers. They can also hold:
This flexibility makes them powerful tools for building scalable apps without cluttering the OnStart property.
OnStart execution is requiredNate 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.