Configure dynamic fields in a view
Some data changes from contact to contact, so you can't hardcode it. For example, a screen pop might show the customer's name and profile ID.
To dynamically populate a component field:
-
Open the Properties tab for the component.
-
Choose the dynamic icon (the lightning bolt) that appears next to the field you want to be dynamic.
The most common fields that require dynamic values are:
-
The Value field for display fields.
-
The DefaultValue field in form inputs.
You can set any field in the Properties tab to dynamic, whether it's visible to users or hidden.
For example, look at the AttributeBar component in the following image.
-
The Label of Attribute 1 is static: Customer Name.
-
The Value of the attribute is set to dynamic (the lightning bolt icon is selected).
With these settings, the value comes from the data passed into the Show view block at runtime.
When you set a field to dynamic, a dynamic reference replaces its static value, and a Sample Data section appears below the field. You use this section to define sample data.
The dynamic reference reflects the data structure expected by the Show view block when
setting up runtime data. For example, consider the Value of
Attribute 1 in the AttributeBar
-
When set to dynamic, the field becomes
$.AttributeBar_1.Attributes[0].Value, whereAttributeBar_1is the Id of the component. -
This indicates that in the Show view block, the
AttributeBar_1field should receive an object. -
The object contains an
Attributesarray where the first item ([0]) is expected to be an object with aValuefield.
You can edit dynamic references for clarity or reusability. Dynamic references can
be shared across multiple fields and components within the view. For example, in the
following image of the AttributeBar$.myAttributeValue. The Show view block now has a
myAttributeValue field that expects a string input.
Important
The type of the dynamic reference must match the expected type of the field. For example, you can't use a string-based dynamic reference in a Boolean field. The following image shows an example error message when the dynamic reference doesn't match.
You can also set every property of an attribute to dynamic. In the following image, everything about this attribute, including the label, is determined at runtime based on the values passed into the Show view block. For example, Customer Name is now sample data that you can use to preview what users see. Users don't see the sample value itself.
For certain components, such as AttributeBar