How to map Salesforce fields to template (Legacy)
The easiest way to enable document automation is mapping Salesforce fields into your document template. Mapping can be done by drag and drop fields from Data Source tab in the right panel.
The Data Source tab
In the document template workspace, select the Data icon at right-side panel to open Data Source. Select the Salesforce sub-tab
![image-20240109-070557.png](../__attachments/158269506/image-20240109-070557.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
Salesforce tab displays Salesforce objects can be mapped into templates, including the Main Object and additional objects which are added in the Flow Setting.
When clicking to the Object name, you automatically open the Fields option, which lists all object fields and fields in referenced objects as a tree structure. Field name starting with arrow is a reference field to another object. Clicking the reference field to display all fields from the referenced object.
![image-20240109-070605.png](../__attachments/158269506/image-20240109-070605.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
Drag and drop fields to template
Select the fields you want to map in the template.
In the Add new content element, select the drop to document button then drag and drop it to the right position in the template.
![image-20240109-070631.png](../__attachments/158269506/image-20240109-070631.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
A new span with the dynamic content will be created in the template as a child element of the element at the drop location.
For examples:
![image-20240109-070638.png](../__attachments/158269506/image-20240109-070638.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
![image-20240109-070645.png](../__attachments/158269506/image-20240109-070645.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
Select the Tags icon next to Data, you can see in the Content, the API name of the mapped field: Opportunity.Account.Name
![image-20240109-070651.png](../__attachments/158269506/image-20240109-070651.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
The text <Account Name> is only a placeholder in the template. When end-users generate the documents, the placeholder will be replaced with data from the field specified in the Content, in this example, Opportunity.Account.Name
You can edit the text in placeholder as long as information in the Content is correct.
Add field to selected text
Quite often you have ready-made static content in the template, and want to add the dynamic content into existing placeholders
Instead of drop field to document, you can select the text in the template to be a placeholder. In the Data Source view, select Add to text selection.
![image-20240109-070659.png](../__attachments/158269506/image-20240109-070659.png?inst-v=5205e5d1-dc16-46d7-af02-1258d99cc136)
If text selection already has dynamic content, the button will show: “Invalid selection”.
Best Practice:
The Data Source view remain the same even after you have completed the merge. It helps in case you need to map one field in multiple locations in the template, without browsing the data structure again. The most common example is having the Account Name mentioned throughout the document.