Generate Files from a Campaign Record

2.7.0 | 3/28/2025

Individual Documents or Pages | Step 1: Define the Routine | Step 2: Creating Template | XLSX Document of Campaign Members | Step 1.2: Define the Routine for XLSX | Step 2: Create a XLSX template

How to generate with Campaigns?

Campaigns in Salesforce help track marketing efforts, event participation, and targeted outreach. By merging Campaign data into documents, you can create:

  • Individual documents for each Campaign Member – Ideal for generating personalized letters, event invitations, or thank-you notes.
  • An XLSX document listing all Campaign Members – Useful for reporting, tracking participation, or exporting Campaign data.

Note: This article is using Full Speed edition of Mambo Merge. Some features mentioned are available only in Full Speed and Performance editions.

Individual Documents or Pages for each Campaign Member

Step 1: Create a Routine & Assign to Component for Campaigns Members

To generate documents from the Campaign object, you may need to add a Mambo Merge Component and create a Routine in the Studio.

For additional guidance, check out:

1.1 Access Studio
  • Open Salesforce and go to a Campaign record (Or any page with Mambo Merge Component present).

  • Locate the Mambo Merge Component on the page.

  • Click the Dropdown Menu (Down Arrow) and select Studio.

    OR

  • Click the Gear Icon in the top right corner.

  • Select Setup.

  • In Quick Find field, type Installed Packages.

  • Locate Mambo Merge and click Configure.

  • In the Header, click the dropdown next to Support.

  • Select Studio.

IMAGE1

1.2 Define the Routine
  1. In Studio, click New Routine.
  2. Choose Primary Salesforce Object to Campaign Members
  3. Under Record Selection, select Record Where
  4. Add Filter: Campaign Id equals Current Record

IMAGE2

  1. Click Nextto continue through the Routine Setup till Templates page.

  2. Add a Template:

    • Click Dropdown and select Upload Template. (More Info)
    • Or select checkbox Upload Template upon Merge for ease with testing.

    Note: Choosing this checkbox removes any other Template selection.

  3. Click Next. Continuing to the Save Routine page.

  4. Name the Routine (e.g., Campaign Members), select Display Options and save.

IMAGE6

1.3 Assign Routine to Component
  1. Return to Campaign record page.
  2. Click the Gear Icon in the top right corner.
  3. Select Edit Page.
  4. In the Lightning App Builder click on the Mambo Merge Component in the Preview center Panel.
  5. In the right panel, input your Routine Name (e.g., Campaign Members) in the Routine/Template Id field.

IMAGE3

Step 2: Create a Template

2.1 Create a DOCX template for the individual documents.

Note: Mambo Merge supports DOCX, PPTX, XSLX template files created in Microsoft Word, Google Docs and other Document Editing Software.

  • Insert merge fields such as {{Name}}, {{Email}}, and {{Campaign.Name}} identifiable in the Template Builder or the Merge Data page in the Studio.

  • Personalize the content (e.g., invitations, thank-you letters, or membership updates).

  • Save the template.

2.2 Update the Routine Output Format

  • Choose One Document per Record or Single Document (One Record per Page) in the Merge Type section on the Template page in Routine.

  • Upload new or updated version of template.

  • Save changes to the Routine.

Note: Always test templates before making them available to users.

XLSX Document of Campaign Members

Step 1: Create a Routine & Assign to Component for Campaign

To generate a document that dynamically fills each row with Campaign Member data, create a Routine in the Studio.

1.1 Access Studio

Follow the same steps as 1.1 Access Studio in the Individual Documents section.

1.2 Define the Routine
  1. In Studio, click New Routine.
  2. Choose Primary Salesforce Object to Campaign
  3. Under Record Selection, select Single Record. Click Next.

IMAGE4

  1. On the Relationship page, select Campaign Members as a related list.

IMAGE5

  1. Click Next to continue through the Routine to the Templates page.
  2. Choose either option that works best for your initial setup.
    • Click Dropdown and select Upload Template. (See Studio: Routine Templates for more guidance)
    • Or select checkbox Upload Template upon Merge, so you can create and test the template. (Choosing this checkbox removes any other Template selection.)
  3. Click Next to continue through the Routine to Save Routine page.
  4. Name the Routine (e.g., Campaign Members), select Display Options and save.

IMAGE8

1.3 Assign Routine to Component

Follow the same steps as 1.3 Assign the Routine to the Component in the Individual Documents section.

Step 2: Creating Templates

2.1 Create an XLSX Template

  • Insert merge fields such as {{Name}}, {{Email}}, and {{Campaign.Name}} identifiable in the Template Builder or the Merge Data page in the Studio.

  • Use the forEach merge function to create dynamic rows for each Campaign Member:

       {{forEach:CampaignMember}}
    
    • In the First Cell of a Row, put the forEach merge function of the Related List.

Note: Normally, the forEach merge function needs a closing tag. This still works with the XLSX Template, but outputs data inside a single cell instead of across a whole row. Some Merge functions are slightly formatted differently in XLSX depending on how you want the data outputted.

  • Personalize the content (e.g., invitations, thank-you letters, or membership updates).

  • Save Template.

2.2 Update the Routine Output Format

  • Upload new or updated version of Template.

  • Save changes to the Routine.

Note: Be sure to test your templates to avoid mistakes.

Campaign Document Generation

By integrating Mambo Merge with Salesforce Campaigns, you can generate documents quickly and efficiently. Whether you need a detailed XLSX report of Campaign Members or personalized documents for outreach, Mambo Merge automates the process and saves valuable time.

For further assistance, check out:

  • How to Use Routine Wizard Templates
  • Advanced Merging with Related Lists

Back to Top