DocumentationCenterpoint for SalesforceData templates

Data templates

A data template says which Salesforce records and fields go into the data sent to a letter template or to a Smartform. One data template can serve many templates, so you describe a data structure once and reuse it.

You build data templates on the Template SObject Mapping tab of The Configuration screen.

How a data template is built

A data template is a list of rows. Each row adds one set of records to the data, in the order of the Order number. The first row is always the record the user is looking at.

RelationWhat it adds
RecordThe current record. This is row 1.
LookupA record that the current record points to through a lookup field, for example the Account of a Case.
ChildThe records that point to the current record, for example the Contacts of an Account.
ChildLookupA record that each child record points to through a lookup field. Its fields are added to the child’s data.

Each row also has an XML Node name, which is the name of the node in the data that represents the row, and an optional XML Parent Node name, which wraps all the records of a child row in one parent node.

Create a data template

  1. Open the Metaforce Application tab and click the Template SObject Mapping tab.
  2. Click New data template.
  3. Enter a Template name and choose the Root SObject, the object the template starts from. The name is what templates and Smartforms refer to later.
  4. Click Create. The new template starts with row 1, the root record.
  5. Add the related records you need:
    • Click Add Lookup and choose a Lookup field (root record).
    • Click Add Child and choose a Child relationship.
    • Click Add Child Lookup, choose the Child object the lookup belongs to, then choose the Lookup field on child.
  6. To change the order of the rows, use the up and down arrows in the Actions column. The trash can removes a row.
  7. Click Save.

Below the table, the tab shows a diagram of the objects in the template and the XML that the template produces, so you can check the result before you use it. If a row points to an object or field that does not exist, the Invalid SObject mapping dialog opens and the diagram marks the row as N/A or missing. Update or delete that row. An empty template shows No rows. Create a new template or add Lookup / Child / Child Lookup.

To remove a whole data template, select it in the Data template list, click Delete data template and confirm. This removes the template and all of its rows and cannot be undone.

Use a data template

  • In a letter template: add the keyword DATATEMPLATE=<template name> to the template in Centerpoint. See Template keywords.
  • In a Smartform: add the same keyword to the Smartform dialog. The data from the template is sent to the form, and child records fill its tables. See Smartforms.
  • From your own code: a data service written in Apex can supply the data instead. Name it with the DATASOURCE keyword. See External Data Service and the Editor Apex API.

Details

  • A ChildLookup row adds the fields of the looked-up record to every child record, with the row’s XML node name as a prefix. A ChildLookup with the node name Product2 adds fields such as Product2.Name. The row’s XML Parent Node names the child row it belongs to.
  • The builder edits the Template SObject Map custom setting, so you can also edit the same rows by hand in Setup. Some fields exist only there, for example Filter, a SOQL WHERE clause that limits the child records, and Field Prefix. See Template SObject Map.