Use Power Fx in Power Pages (preview)
[This topic is prerelease documentation and is subject to change.]
Power Fx is the low-code language for expressing logic across the Microsoft Power Platform. It's a general-purpose, strong-typed, declarative, and functional programming language.
Power Fx is expressed in human-friendly text. It's a low-code language that makers can work with directly in an Excel-like formula bar. The "low" in low-code is due to the concise and simple nature of the language, making common programming tasks easy for both makers and developers.
Note
You might find the syntax for authoring Power Fx formula to be different than what you are used to in Power Apps or Power Automate. To initiate a Power Fx expression, it must begin with an '=' (equal sign) like in Excel. For more information, see Important considerations.
Power Fx enables the full spectrum of development from no-code makers without any programming knowledge to pro-code for professional developers. It facilitates collaboration among diverse teams, helping them save time and effort.
Important
- This is a preview feature.
- Preview features aren’t meant for production use and may have restricted functionality. These features are available before an official release so that customers can get early access and provide feedback.
- The feature is available with Power Pages version 9.6.5.x.
Use Power Fx in Power Pages
Within a Power Pages website, Power Fx is available as an expression language for use with the following components and their attributes. This functionality allows the dynamic assignment of values based on the outcomes of Power Fx expressions.
Component | Properties |
---|---|
Text | Text |
Image | Image URL, Alt Text |
Button | Button URL, Button text |
Iframe | Iframe URL |
Use the Power Fx formula bar
The toolbar includes a new fx command for components that support Power Fx:
Select fx to access the Power Fx formula bar.
Formula bar components
The following screenshot highlights some of the important components of the formula bar:
A dropdown menu allows you to choose from the available component properties.
A multiline expandable textbox allows authoring of Power Fx formulas.
The Reset button sets a component property to its default.
The Save button persists the formula and expressions for the component property. The studio canvas is immediately updated if the resulting value is available and can be shown such as in text properties.
Formula bar experiences
The following are some developer centric features for increased productivity:
Autocomplete assistance: suggests formulas, parameters, tables, and objects. Select Ctrl + space to manually access this feature.
View problem capability: helps in early validation and debugging of formulas and expressions.
Unsaved changes dialog: is shown if you navigate away from the formula bar when there are unsaved changes to a formula.
Select Go back to continue editing the formula or Discard to discard the changes.
Important considerations
Consider the following guidelines when you use the Power Fx formula bar in Power Pages:
Start with an equals sign: Text can be entered directly as the value. To initiate a Power Fx expression, it must begin with an '=' (equal sign) as shown in the following example:
=Concatenate("Hello, ", User.FullName)
Tables are accessed securely: Dataverse tables can be accessed securely using formulas. Verify table permissions are appropriately configured first. Also, the context of a site user is available using the User object. For example, the following expression retrieves the DataverseUserId value of the currently authenticated user.
=Concatenate("Hello, ", First(Filter(Contacts,Contact = User.DataverseUserId)).'First Name' & "!")
Note
The User object represents a Power Pages user and hence does not support the same set of properties as the User function.
Inserting a value within text: To insert a value within text, use the following syntax.
This text ${variable/ expression} includes a dynamic value.
For example:
The total number is ${Sum(10, 20)}
Available Power Fx functions
For the complete list of all available functions in Power Pages, go to Formula reference – Power Pages.
Known issues and limitations
Some Power Fx functions presented through IntelliSense aren't currently supported in Power Pages. Those functions display the following design time error when used:
Parameter 'Value': PowerFx type is not supported.
The system doesn't initialize the User for anonymous users, which results in the following error when you use it on any form, including a check for blanks. This issue will be fixed in a future release.
UserInfo object was not added to service
Some users might see problems with Button and Image URL properties not working when the value is set with Power Fx formulas or expressions that contain double quotes. This issue only happens if you have version 9.6.3.x and is fixed when your Power Pages site is upgraded to version 9.6.5.x.
Frequently asked questions
Should I use Power Fx instead of Liquid?
Power Fx fulfills certain dynamic data scenarios in a low-code way that might also be achieved via Liquid code with pro-developer tools. Power Fx, presently in its public preview phase, is recommended for trial or developmental site evaluations. We welcome your feedback during this stage. Liquid is a generally available (GA) feature and comparatively provides more capabilities. Use Liquid for your production websites, particularly in scenarios that are critical and complex.