Using Data Functions

A data function lets you connect to a standard or custom Salesforce object, perform calculations on the returned results, and display the calculation on the page. For example, for a particular field in an object, you can use a data function to calculate the total value or the average amount of all returned records.

Required Editions

Available in: Salesforce Classic

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

Available (with limitations) in: Developer Edition

User Permissions Needed
To build, edit, and manage Site.com sites:

Site.com Publisher User field enabled on the user detail page

AND

Site administrator or designer role assigned at the site level

To edit the guest user profile:

Site.com Publisher User field enabled on the user detail page

AND

Site administrator or designer role assigned at the site level

AND

Manage Profiles and Permission Sets

AND

Customize Application

To add a data function to a page:

  1. Drag a Data Function from the Page Elements pane onto the page.
  2. Select the object that you want to connect to.
    Note
    Note
    • For Site.com users, the drop-down list only displays objects that are available to guest users because site visitors access your public site via the Guest User license. To make other objects available, go to the guest user profile, enable the relevant object's “Read” permission, and refresh the list.
    • For Communities users, the drop-down list displays objects that may not be available to site visitors. For authenticated visitors, object access on public and private pages is controlled by their user profiles. For unauthenticated visitors, object access on public pages is controlled by the site's guest user profile.
  3. Optionally, in Filters, select criteria to filter your data set. If you don't select any criteria, all the data from the item is returned.
    1. Select the field to which the filter criteria apply. The Field drop-down list displays the object's fields, followed by the fields of all parent objects, which use the format parent_object_name.field_name.
    2. Select the operator to control how results are filtered. For example, select Equals to return an exact match.
    3. Select the source of the filter value. For example, to specify an explicit value, select Fixed value, or to use the values passed to the page via a query string, select URL query string.
    4. Set the value of the filter. If you're using a query string, you can also specify what should happen if the query string is missing.
    5. Add additional filter criteria as required to narrow your results further. Each filter item is combined with an AND operator.
    Note
    Note If you're using a fixed value to filter the results, you can view the returned records in the Connection Preview section. To refresh the list of records, click Reload Preview.
  4. In Functions, select a function:
    Option Description
    Count Counts the number of records that contain a value for the selected field. For example, if an object contains 30 records, but only 25 records have a value in the field you specify, the result is 25.
    Maximum Returns the highest value of all the values for the selected field. Applies to numbers, strings, and dates.
    Average Calculates the average value of all records for the selected field. For example, if you have 20 records with a total value of $20,000 in the Price field, the average is $1,000. Only applicable to fields that contain numbers.
    Minimum Returns the lowest value of all the values for the selected field. Applies to numbers, strings, and dates.
    Sum Calculates the total value of all records for the selected field.
  5. Select the field it applies to.
  6. Click Save.