Download PDF
Download page Advanced Data Gathering Using JSON Data.
Advanced Data Gathering Using JSON Data
Conga Composer can consume Key-Value pairs stored in Salesforce fields as JSON strings to merge JSON data into a Composer template along with Salesforce field data and External data.
Important
- This release only supports Microsoft Word and Conga Email templates.
- It is only supported in Classic Composer buttons.
- It is not supported in Salesforce Mobile solutions.
- JSON values and Salesforce field values cannot currently be included in the same tables.
- It is not supported with Conga Batch and Conga Trigger.
To merge JSON data
- Include the FieldDataSource parameter into your Composer Solution or Button.
Use the Template Builder to add JSON merge fields to the template or add JSON merge fields manually in the format "{{jsonkey}}" to the template.
Include the HTML prefix for JSON merge fields in the template.
For merging the JSON values, you must include a TableStart and TableEnd (which are not always required in Word Table).
As shown below, a merge table includes
TableStart
with theFieldDataSource
and thejsonkey
representing the JSON child field name for theFieldDataSource
JSON data.{{TableStart:FieldDataSource}}
{{jsonkey}}
{{jsonkey}}
{{TableEnd:FieldDataSource}}
Using the query parameter
FieldDataSource=
JSON Attributes
, with child fieldsinsuredFirstName
andinsuredLastName
, the resulting table configuration would be:{{TableStart:JSON_Attributes__c}}
{{insuredFirstName}}
{{insuredLastName}}
{{TableEnd:JSON_Attributes__c}}
TableStart
andTableEnd
are the constant merge field tags, andJSON_Attributes__c
is the source field API name and key for the table. Thejsonkey
's are replaced with the desired JSON child field names, such asinsuredFirstName
andinsuredLastName
.FieldDataSource
is a comma-separated parameter. Be sure to use the corresponding field API name from the parameter in the merge table configuration afterTableStart
andTableEnd.
Examples:
The following examples show the output for the different scenarios for the above configuration for master objects and child objects as the location for the FieldDataSource.
Example 1:
As shown below, a field called JSON Attributes
(API Name: JSON_Attributes__c
) on the master object is the source for the JSON data (FieldDataSource
) merge field for the Setup configuration:
JSON data stored in the field:
Master Object Field
(
FieldDataSource
)Master Object Field Value
(
JSON Data
)JSON Attributes
"StepPrimaryDriverInfo":{"insuredLastName":"Doe", "insuredFirstName":"Jane"}
Table configuration for the template merge table:
{{TableStart:JSON_Attributes__c}}
{{insuredFirstName}}
{{insuredLastName}}
{{TableEnd:JSON_Attributes__c}}
Composer Solution merges the value Jane into
{{insuredFirstName}}
and Doe into{{insuredLastName}}.
The resulting table is:Jane Doe
Example 2:
As shown below, a field called JSON Attributes
(API Name: JSON_Attributes__c
) is the source of the JSON data (FieldDataSource
) merge field for the Setup configuration:
JSON data stored in the field on the Opportunity object:
{ "portfolio": [ { "recommended": { "FullName": "Recommend Products", "ExecutiveSummary": "The products below are ASAP Corporations recommendations for products that exceed your requirements, but have much more reliability and lifetime warranty.", "whereSold": { "zones": [ { "zone": "NA" }, { "zone": "EU" }, { "zone": "AP" } ] }, "products": [ { "type": "prem", "name": "Hydro Flask Water Bottle", "quantity": "8", "price": "50", "total": "400" }, { "type": "prem", "name": "Protective Silicone Boot", "quantity": "8", "price": "10", "total": "80" } ] } }, { "standard": { "FullName": "Standard Products", "ExecutiveSummary": "These products meet your minimum requirements, but do not offer the same reliability and only 1 year warranty.", "whereSold": { "zones": [ { "zone": "NA" } ] }, "products": [ { "type": "std", "name": "Wide Mouth - Hydro Flask 32 oz", "quantity": "8", "price": "25", "total": "200" }, { "type": "std", "name": "Wide Mouth - Hydro Flask protection cup for 32 oz", "quantity": "8", "price": "5", "total": "40" } ] } } ] }
CODETable configuration for the template merge table:
Important
To merge the details from the Child Object, you must use UNDERSCORE with the Salesforce field. (for example,
Salesforcefield_ChildObject
).- Composer Solution:
Merged Document: