- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
UI Builder Deep Dives Part 1
Table of Contents
Overview
What are dynamic property values?
Using Formula Builder
- At the top, under the modal header, you will see the "Formula area". This is where the currently configured value will appear. If the Apply button is active, clicking it will cause the formula that appear to be the value for the property.
- In the bottom left panel, you have the Data Type Category Selector (and a tab to access the Formula Category Selector). This will allow you to browse different data you can use to configure the value.
- In the bottom right panel, you will see the Pill View. This gives you a "dot walk"-able display of the different data that is available for the selected category. Clicking a pill will either allow you to add that pill to the Formula Area and/or dot walk further into the data.
Data Types
- Page Properties: This is all data coming into your page from outside of it.
- App: These are values set up in
sys_ux_page_properties
for your application. Don't worry about that too much right now if you don't know what these are. - Props: These are the values of the Properties of your page. You can see what properties are available on your page by clicking on Body in the Component Tree Navigator and going to the Config tab in the Component Configuration panel to the right. The most common use of these are for the properties that expose the Required Fields and Optional Params for this Page (such as table or sys_id for instance in a Record page).
- Session: These are commonly used values from the user's GlideSession. Keep in mind this is the GlideSession of the user that is viewing your page. Some useful data in here is things like the user's first name, last name, avatar URL, and timezone.
- App: These are values set up in
- Data Resources: All the data resources available to this page. Most of them will be data resources that you have added to this page explicitly, though some may be "inherited" - usually when you are creating a Viewport/Page Collection page. In the bottom right panel there will be pills for each data resource, and you will be able to "dot walk" down the data they output to select the exact piece of data you would like to use.
- Component: This is a rarely used option, but some components expose data themselves for use by other components. An example of this is the List Menu component. Most usages of this category have been deprecated in recent releases of the Next Experience Framework. The bottom right panel will have pills for any component that exposes a property that can be bound in this way. You can "dot walk" it just like everything else.
- Client State: Here you will have listed all of the client state parameters you have created for this page. In the bottom right panel, you will see a pill for each of them, and if any of them are complex data, you will be able to "dot walk" it as well.
Pill View / JSON View
Understanding how dynamic properties work
More complex dynamic property configuration with formulas
IF(!@data.rpCtrl.activityStream.isComposeVisible, "stacked", @data.rpCtrl.activityStream.layout)
IF
function in Excel. Inside the parentheses are the inputs to the function:- The first input is a condition, which means the value will either be
true
orfalse
. Here the condition is referencing a condition that is output from a Controller and then using the!
or NOT function to flip the condition. - The second input is some text. If the condition is true, this will be the value of the property.
- The second input is a reference to some other data from the same controller as the first input. We can assume that is normally has a text value as well. If the condition is false, this will be the value of the property.
Quiz time
Reading the formula above, if @Data.rpCtrl.activityStream.isComposeVisible
is true, what will the value of the property be?
Answer ▼
stacked
will be the value of the property.
Reading the formula above, if @Data.rpCtrl.activityStream.isComposeVisible
is false, and @Data.rpCtrl.activityStream.layout
is other
, what will the value of the property be?
Answer ▼
other
will be the value of the property.
How formulas work at runtime
High performance data configuration patterns
- Only use dynamic configuration when actually needed. Make sure that the data actually changes. If not, just use static configuration.
- Try to only reference data, avoid formulas. If you know when the referenced data will change, it's better to calculate the value you need in a Client Script and save it to a client state parameter and just reference the client state parameter.
- Go out of your way to not repeatedly process arrays to create a value. Deriving a value from an array, or transforming an array should almost never be done at the property configuration level. This will be done more often than you think, and can lead to significant page performance issues at scale.
Dynamic properties using scripting
How to access the script editor in Formula Builder
<>
button in the top right of the Formula Builder. You'll see it highlighted in the following screenshot:
Using scripts to dynamically configure properties
- While the scripting language is JavaScript, many APIs normally available in the browser are not available. This includes anything that would allow you to change elements directly using builtin Document Object Model (DOM) APIs.
- Try to do as little work as possible in the script.
- If it can be a formula, make it a formula - even if you write a script to figure things out at first.
- When you change the element ID of an element or data resource, or the name of a client state parameter, your scripts will NOT be updated. Formulas will always have references updated when IDs change.
Conclusion
Congratulations! 🎉 You've gotten a whirlwind tour of all the capabilities that UI Builder offers for configuring dynamic properties. Let's recap.
- Data references offer a simple way to connect the value of a property to another piece of data available on the page.
- These references ensure that the property value is always up to date when the referenced data changes.
- Formulas allow you to use basic logic and perform a number of transformations of static and referenced data.
- Scripting is an option, but should be used rarely and with caution.
Formulas are a deep topic of their own, and time does not allow us to cover all of it in the article. If there is some part of this topic you'd like to see a deeper dive on, please let us know in the comments below.
If you found this guide helpful, consider sharing it with peers or teams looking to elevate their UI Builder skills with dynamic visualizations.
Keep an eye out for future tutorials where we’ll dive deeper into crafting immersive, data-driven experiences. Until then—happy designing, and stay curious!
Check out the Next Experience Center of Excellence for more resources
- 3,094 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.