Menu

SFDC DATA MAPPER

A library of commands that are related to Salesforce data mapper and translation features.

record

Retrieves values of specified fields of a single Salesforce record and stores the data into the variable context as a Salesforce Data item value.

Attributes

var

Required
Value type
EL-evaluated
Yes
String No
Name of the variable that holds the Data item.
type

Required
Value type
EL-evaluated
Yes
String Yes
The resolved value of this attribute should be the API name of the target record's object type. 
recordID

Required
Value type
EL-evaluated
Yes
String Yes
Defines the ID of the record whose data is to be retrieved.
fields

Required
Value type
EL-evaluated
Yes
String No
Defines the fields whose values are retrieved. The resolved String should be a comma-separated list of the fields' API names, eg. "Id, Name, Quantity".
mainRecord

Required
Value type
EL-evaluated
No Boolean No
If the value of this attribute is true, the object named in the type attribute is set as the main object of the template. If the document's logic, such as queries, require a record of a particular object type to be externally specified, that object type should be the main object.

If more than one record command has this attribute set as true, the command that is evaluated last sets the main object.

The default value of this attribute is false.

Examples

Use the record command when you need to get data of a single record whose Id is known.

<record var="mainOpp" type="Opportunity" recordID="${id}" fields="Name, CloseDate, Amount, Description">
relatedList

Retrieves data of records sharing a common parent record and object type, and stores the results into the variable context as a Collection of Salesforce Data item values.

Attributes

var

Required
Value type
EL-evaluated
Yes
String No
Name of the variable that holds the Collection.
type

Required
Value type
EL-evaluated
Yes
String Yes
The resolved value of this attribute should be the API name of the object type that the child records share. 
parentID

Required
Value type
EL-evaluated
Yes
String Yes
Defines the ID of the parent record. 
parentType

Required
Value type
EL-evaluated
Yes
String Yes
The resolved value of this attribute should be the API name of the parent record's object type. 
fields

Required
Value type
EL-evaluated
Yes
String Yes
Defines the fields whose values are retrieved. The resolved String should be a comma-separated list of the fields' API names, eg. "Id, Name, Quantity".
orderBy

Required
Value type
EL-evaluated
No String Yes
Defines fields by whose values the results are sorted. The resolved String should be a comma-separated list of child record field API names. 
where

Required
Value type
EL-evaluated
No String Yes
This attribute can be used to define filtering conditions to limit the amount of results. The resolved String should specify one or more condition expressions in SOQL Condition Expression Syntax

Examples

Get an Opportunity record's OpportunityLineItems:

<relatedList var="lineItems" type="OpportunityLineItem" parentID="${oppID}" parentType="Opportunity" fields="Product2.Name, Quantity">

Use the orderBy and where attributes to sort and narrow the list of results:

<relatedList var="plentifulLineItems" type="OpportunityLineItem" parentID="${oppID}" parentType="Opportunity" fields="Product2.Name, Quantity" where="Quantity > 100" orderBy="Quantity">
relatedListRecord

Retrieves data of a child record of a specified parent record and stores the result into the variable context as a Salesforce Data item value. Highly similar to relatedList, but only retrieves one child record.

Attributes

var

Required
Value type
EL-evaluated
Yes
String No
Name of the variable that holds the Data item.
type

Required
Value type
EL-evaluated
Yes
String Yes
The resolved value of this attribute should be the API name of the child record's object type. 
parentID

Required
Value type
EL-evaluated
Yes
String Yes
Defines the ID of the parent record. 
parentType

Required
Value type
EL-evaluated
Yes
String Yes
The resolved value of this attribute should be the API name of the parent record's object type. 
fields

Required
Value type
EL-evaluated
Yes
String Yes
Defines the fields whose values are retrieved. The resolved String should be a comma-separated list of the fields' API names, eg. "Id, Name, Quantity".
where

Required
Value type
EL-evaluated
Yes String Yes
This attribute defines the filtering conditions to limit the amount of results, preferably to a single record. The resolved String should specify one or more condition expressions in SOQL Condition Expression Syntax
setLabelTranslations

Allows data exported from Salesforce's Translation Workbench to be used in the logic. Currently this command provides automatic translation of labels of picklist values and may optionally store Custom label values into the variable context.                        

To make use of this command, the Dynamo template needs to contain data exported (ZIP file) from the Translation Workbench. Use the language attribute to define which language is used from the set of languages defined in the organization.

Picklist values

After this command has been evaluated, labels of picklist values retrieved from Salesforce undergo automatic translation to the defined language. For example, an EL expression referring to an  Opportunity's stage, ${opportunity.StageName.label}, would be affected by this assuming the translation data contains translations for the different stage names. If a translation for a value is not defined, the expression resolves into the default label.

Please note that at the moment this translation feature does not work for values of picklist fields using global value sets.

Custom labels

The data from Translation Workbench contains data of all the Custom labels in the organization, and so this command can make the values of these labels available in the variable context. Just define the customLabelsVar attribute and Custom label values in the defined language will be stored there.

The labels can be accessed through EL with expressions similar to those present in Salesforce Lightning Components: the format is ${yourCustomLabelsVar.namespace.labelName}. For example, with customLabelsVar of "customLabels", a Custom label in the default namespace called "Test_Label" would be behind the expression ${customLabels.c.Test_Label} and the Custom label "Flow_info" in the "dynamo" namespace is found with ${customLabels.dynamo.Flow_info}. The resolved label value will be in the language defined through this command, unless a translation for the label is missing in which case the resolved value is the untranslated, original label value.

Attributes

language

Required
Value type
EL-evaluated
Yes
String No
Defines the code of the language in which the translated values should appear in. Needs to be one of the languages present in the exported Translation Workbench data. Salesforce's documentation page for its Supported Languages displays the possible language codes.
customLabelsVar

Required
Value type
EL-evaluated
No String No
If defined, Custom label values in the language defined by language are stored into the variable context with this variable name.

Examples

Assuming you've got suitable translation data present in your application, the data is put to use like this:

<setLabelTranslations language="de">

Afterwards, picklist value labels are automatically translated (into German in this example), unless the translation data is missing an entry for the requested picklist value. To get the label of the picklist value, use the "label" property:

<span dyn-content="opp.StageName.label"/>

Custom labels can be made available by defining the customLabelsVar attribute:

<setLabelTranslations language="de" customLabelsVar="customLabels">
<span dyn-content="${customLabels.c.Test_label}">
updateRecords

Updates field values of Salesforce records based on the bind commands present in the template's document content. This works with both bind for DOCX templates and bind for HTML templates.

This command needs to be run after all the bind commands' input has been read. In a Flow template, the reading of the commands has to be done using the readInputs command. After it has been successfully evaluated, updateRecords can be used to transfers the data into Salesforce. Typically this logic is placed in the template's custom button Flow. In a Controller template, the reading of the commands is done automatically when post-composing events, such as button clicks, are triggered. Therefore those events' handlers are where the updateRecords command should be placed.

Comments

0 comments