Page Data Connections Page Data Connections provide a way to retrieve data from into a page.  They allow the page implementer to specify a connection to a Salesforce object that can be used from within the entire page.  This article describes how Page Data Connections can be used in page templates and pages.


Page Data Connections are useful for record detail/informational page templates or pages.  Prior to Page Data Connections, the most common way to create a record detail page was to add a data repeater to the page template (or page), add a filter to it to get the specific record, and add all data access elements as child elements.  Now, a Page Data Connection to a specific object can be specified at the page template or page level and all data access elements or expressions in the page will automatically have access to the fields of the object.

Example Data Model

An example of a product detail page with related products is used to illustrate the features.  The relationship is a many-to-many from Product to Product.  A junction object called Product Relation exists to relate the main product to its related products and allow the user to specify the type of relation.  For example, a diesel engine product could have two related products that are related as cross-sell products.

product detail pageAdding to the Page Template

The Page Data Connection can be added to a page template or a page.  In many cases, it makes sense to add it to the page template (e.g., product page template), so that all children have access to fields automatically.  To add the Page Data Connection, select the page element in the sidebar element navigator to view the page properties in the properties panel.  From the properties panel, select the Page Data Connection section and click the button to add the Page Data Connection.

page template select page data connection

Clicking the Add Connection button will display the dialog to create the data connection.

page template create data connection

If you do not see the desired object in the picklist, you might need to click the link to enable the correct permissions on the Guest Profile, first.  Since this is a page template that can be used for all products a way to specify which product’s page is being used is needed.  This can be done by specifying a filter of the Product ID as a URL query string (e.g., Product?id=01t2000000111X1).

Using in the Page Template

In this example, the list of related cross-sell products for a given product should always be displayed in the footer section for each product’s page.  Since every product needs it and the look and feel should be uniform, the best place to put it is in the product template.  This can be done by adding a data repeater element to the page template footer, so that the final structure of the page template is as follows.

page template structure

The data repeater should be configured to retrieve all Product Relation records where the type is Cross-Sell and the Main Product is the Parent Repeater. In this case the Parent Repeater is actually the Page Data Connection.

related list data repeater edit

Once the data repeater for the related list is set up, data elements can be added as child elements to it.  For example, links to the related product pages could be shown on the page.

related list data element

Using in the Page

A page for each product can be created from the product template page.  The product template’s content div should have first been made editable, so that each page can provide their own implementation.  The Page Data Connection is visible in each page’s properties, but it appears read-only and the edit button is disabled.  It is only editable from the page template.

new page with data connection disabled

The fields of the object are available directly from within the entire page. The title property can be set to a field, e.g., {!Name}. Additionally, the fields can be used in other elements, such as content blocks.

page content block edit mode

The final page consists of the content block, maintained at the page level, and the data repeater of related products, maintained at the page template level.

page content block view mode

Summary Page Data Connections provide an efficient and convenient way to provide access to data from Salesforce on a page.  A common use case for a Page Data Connection is an informational/detail page for a type of object (e.g., product).  Check out the help page on Page Data Connections for more information.

2 thoughts on “ Page Data Connections

  1. Great post once again Peter. This is the clean way to reduce the clutter of too many Data Repeaters in your pages. Use templates, use data connections.

Leave a Reply

Your email address will not be published. Required fields are marked *