Merge Child Objects - Magic Merge Knowledge Base

Merge Child Objects

Child objects allow you to include related record data in your merge templates. Display line items on invoices, contacts on account summaries, or any parent-child relationship in your Salesforce org. This guide covers how to configure child object mappings and display them in your documents.

Configuration Settings

Navigate to Settings → Child Objects to map related objects for your template. Each child object mapping requires the following configuration:

Child Object API Name

Select the child object that will be merged with the parent object, in a table, list, or as a single record.

Relationship Field

Choose the lookup or master-detail field that connects the child to the parent object.

Object Order

Use 1, 2, or 3 to determine the prefix (C1, C2, C3) used to reference this child object in the template builder.

Single Record

Check this box if only one record from this child object should be included in the merge.

Record Types

When mapping a child object, you must choose between multiple records or a single record. This choice affects how you can display the data in your template.

Multiple Records

Includes all matching child records. Display in tables or lists that repeat for each record.

Common Use Cases
  • Opportunity Line Items
  • Case Comments
  • Activity History
  • Custom related lists

Single Record

Includes only one child record. Reference fields directly without tables or lists.

Common Use Cases
  • Primary Contact
  • Billing Address record
  • Most recent Activity
  • Default Payment Method

Important: Single record child objects cannot be used in child record tables or lists. Their fields can only be placed directly in the document body using the CX prefix syntax.

The CX Prefix

Each child object is assigned a prefix based on its Object Order setting. Use this prefix when referencing child object fields in your template.

C1
Opportunity Line Items
Reference fields as {C1.ProductName}, {C1.Quantity}, {C1.TotalPrice}
C2
Contacts
Reference fields as {C2.FirstName}, {C2.Email}, {C2.Phone}
C3
Case Comments
Reference fields as {C3.CommentBody}, {C3.CreatedDate}

Display Formats

Multiple record child objects can be displayed in two formats: tables or lists. Choose the format that best fits your document design.

Table Format

Display child records in a structured grid with headers and columns. Ideal for line items, pricing breakdowns, and any data that benefits from column alignment.

Tables automatically generate one row per child record. The header row defines your columns, and the data row serves as a template that repeats for each record.

Example Output
Product Quantity Unit Price Total
Enterprise License 5 $1,200.00 $6,000.00
Implementation Services 1 $3,500.00 $3,500.00
Training Package 2 $750.00 $1,500.00

Table Requirement: All header cells in a child table must contain CX merge fields. Empty header cells or headers with static text only will cause the merge to fail. Each column header should reference the field that will appear in that column.

List Format

Display child records as flowing text paragraphs or formatted blocks. Better suited for narrative documents, letters, or when data doesn't fit neatly into columns.

Lists repeat your template block once per child record, allowing for more flexible formatting than tables.

Example Output
Contact: Sarah Johnson
Email: sarah.johnson@company.com | Phone: (555) 123-4567

Contact: Michael Chen
Email: m.chen@company.com | Phone: (555) 234-5678

Contact: Emily Rodriguez
Email: e.rodriguez@company.com | Phone: (555) 345-6789

Merge Field Syntax

Reference child object fields using the CX prefix followed by the field API name.

Use Case Syntax Example Output
Basic child field {C1.FieldName} Enterprise License
Currency field {C1.TotalPrice} $6,000.00
Lookup field on child {C1.Product>Name} Enterprise License
Relabeled field {C1.Quantity|Qty} Qty: 5
Second child object {C2.Email} contact@company.com

Setting Up Child Objects

1

Open your template and navigate to Settings → Child Objects

2

Click Add Child Object and select the child object API name from the dropdown

3

Choose the relationship field that links the child to your template's parent object

4

Set the Object Order (1, 2, or 3) to assign the CX prefix for this child object

5

Check Single Record if you only want one child record included; leave unchecked for multiple records

6

Save the mapping, then use the CX prefix to add fields to your template in tables, lists, or the document body

Tip: You can map up to three child objects per template (C1, C2, C3). Plan your Object Order assignments based on how frequently you'll reference each child object in your document.