About Displaying Dynamic Data Using Expressions

Site.com uses expression language to display data dynamically. Expressions serve as placeholders for data that is replaced with information when the page loads. When working with data-bound page elements or custom widget properties, you can use expressions to customize how data is displayed on the page.

Required Editions

Available in: Salesforce Classic

Available for purchase in: Enterprise, Performance, and Unlimited Editions

Available (with limitations) in: Developer Edition

In Site.com, expression syntax consists of an open curly brace and exclamation point, the field, custom property name, or namespace name, and a closing curly brace.

For example, if you added a custom property called URL to a widget, you can use the syntax {!URL} to add the expression to custom code or content blocks. Similarly, to add an expression for the Billing City field, you can use the syntax {!BillingCity}. For related objects, the field name is prefixed by the name of the master object: {!Account.BillingCity}.

If you're editing a data element in a data repeater or a data table column, you can access the object's fields by name in a dropdown list without using expressions. However, if you want to customize how the field is displayed on the page, you can see and edit the expression when you click Customize in the dialog box.

If you're working with custom code or content blocks in a data repeater, you can only access the object's fields using expressions.

Expressions let you customize the output by:

  • Adding text around the expression. For example, lets say you're displaying the phone number of each of your business locations. You could enter the text Contact us at before the {!Phone} expression. When the data is displayed on the page, {!Phone} is replaced with the field's value for each record: Contact us at 100–200–3000.
  • Formatting the output using HTML tags. For example, you could wrap H1 tags around the expression to alter how the output is displayed on the page: <H1>{!Phone}</H1>.
  • Creating a URL query string to pass variable information to a data repeater or data table on another page. The second page, in turn, uses the received variable to retrieve and display the relevant records. For example, you could create a hyperlink, such as /product_details?productID={!id}, where {!id} is replaced with the product ID for each record. When a particular product link is clicked, the product ID is passed to the Product Details page, which uses the ID to retrieve the record's information and display it on the page.