Managing your legal practice from Salesforce can keep your information organized and can streamline a lot of the day to day operations.  But as with almost any law firm, there’s always paperwork – lots of paperwork.  From generating documents, sending them to clients, or filing them away, you probably spend hours a day on paperwork.

We’ve got some great news! Add WebMerge to the picture and you can cut the time you spend on paperwork to almost zero.  With WebMerge, you can setup templates for all your documents and easily (and automatically) populate those templates with data from Salesforce.

In this example we’re going to show you how you can generate a Letter of Representation that you can send to a client right from your Salesforce account. We’ll also be using Lob to automatically print and mail this letter to our client.

To get started, let’s setup our Letter or Representation template.  For the template, we’re going to use a Word document so go ahead and create your letter in Microsoft Word.  We’re going to add merge tags in the template where were want the client’s information to go like {$FirstName}, {$LastName}, {$Address}, etc.

Here’s what our letter of representation template looks like:

Once you have the template finished, let’s upload it to WebMerge.  From the Documents page in WebMerge, click the New Document button and enter “Letter of Representation” for the name and click Next.  Here you’re going to want to pick the Office Document type and then pick the file from your computer to upload.

After you upload the template, you’ll be taken to the Settings tab where you can update things like the type of file that we want to generate as well as the name of the file.  For this example we’re going to generate a PDF document and we’re going to add the name of our client in the name of the file.

Once you save the settings, let’s setup the Lob integration so that our letter can be automatically printed and mailed to our client.  Jump over to the Deliver tab and click New Delivery then choose Lob.  You’ll be asked for your Lob API Key and then you’ll see the settings for To and From.

For the “To” address, we’re going to use merge fields.  If the fields do not exist in your document, you can click <<other>> then type in the fields there like: {$Address}, {$City}, {$State}, etc. 

For the “From” address, we’re just going to use a static address, so again we’ll pick the <<other>> option, but then we’ll just type in the normal text instead of merge fields.

Great work!  We’re all finished with the setup inside WebMerge.  Now, let’s jump over to Salesforce and setup the integration so that we can click a button the contact record and generate the letter.

If you haven’t already, please make sure to install the WebMerge managed package from the AppExchange and then follow the setup instructions.

Inside Salesforce, let’s setup a new Mapping.  This mapping tells the system how to send the Salesforce data over to WebMerge so that is matches up with the correct fields in your document.  From the WebMerge Mappings page, click New WebMerge Mapping button.

When setting up the new mapping, give it a name like “Letter of Representation”.  You’ll then select the Salesforce object that you want to pull data from.  We’re going to generate this letter from the Contact object.  The last piece is to select the WebMerge Document that we just setup.

Go ahead and click Save and Next.  You’ll be taken to a page that looks like it has a lot of the same settings at the top of the page, but we’re going to focus on the Field Mapping section of the page.  This is where you’ll setup the “matching” between the merge fields and the Salesforce data.

For each of the merge fields in your document (listed on the left), you’ll need to select the corresponding Salesforce field.

After you have the field mapping done, go ahead and Save and Activate this mapping.  This will make the mapping available from the Contact record when we click the WebMerge button.

Let’s do a test!  Go ahead and open up one of your contacts and click the WebMerge button.

On the next screen you’ll see a list of the other Mappings you have setup for the contact record.  Go ahead and pick the Letter of Representation mapping and click Merge Now.  Note: if you only have 1 mapping, it will be automatically selected/merged.

After a few seconds you’ll be redirected back to the contact record, but behind the scenes WebMerge has generated the Letter of Representation and sent it over to Lob for mailing.  How’s that for easy?

Here’s what our letter looked like:

Congrats, you’re all done!  Now you can easily generate letters, contracts, and more right from your Salesforce account.  All with the click of a button!  Can you think of any other ways that you could use WebMerge inside Salesforce to simplify your paperwork process?

Have more questions? Submit a request


  • Avatar
    David Kunze

    I have an issue for data routing to fire when a custom object's field is modified to satisfy criteria on webmerge mapping. Mapping is set up in Salesforce, data routing (rules,settings and delivery are set up), but when a record in updated it doesn't do anything, no document is created and sent.

  • Avatar
    Jeremy Clarke

    Hi David,

    Data Routing can help route the data once it is sent over from Salesforce, but you need to setup a process inside Salesforce to send over that data when your custom field is updated. We suggest using the Process Builder like this:

  • Avatar
    Florian Wassel


    I added new custom fields to my object in Salesforce and included them in my WebMerge document. However, when trying to do the Field Mapping, I cannot find all of the new fields.
    Do you know what could be the issue?

  • Avatar
    Jeremy Clarke

    Hi Florian,

    Please make sure they have been added to your page layout and that all of your profiles have access to those fields.


  • Avatar
    Jade Foerster

    Is it possible to combine any Attachments & Files from Salesforce with a document created in WebMerge?

  • Avatar
    Jeremy Clarke

    Hi Jade,

    Yes, you can use Data Routing like this:

    In your data route rule, you would enter {$url}, then click the "Repeat this rule" box and enter {$Attachments} in the box.

  • Avatar
    Jade Foerster

    Thanks Jeremy. So what do we put in the mapping to map the Salesforce files to the {$url}?

  • Avatar
    Jeremy Clarke


    Sorry! I should have included that. You'll actually map the {$Attachments} field in your WebMerge Mapping and you should see an option in the dropdown for "Child Relationship: Attachments" or "Child Relationship: Files"

  • Avatar
    Jade Foerster

    That worked. One more question. Is there a way to pull files using a SOQL query?

  • Avatar
    Jeremy Clarke

    Hi Jade,

    Unfortunately, no because we run some special functionality when you send files over to WebMerge and we're not able to do that from an SOQL query :(

    If you need to filter the files, you can do that inside your data route rule like this (this code only includes PDF documents):

    {foreach from=$Attachments item=_attach}{if strstr($_attach.url, ".pdf")}{$_a[] = $_attach}{/foreach}{json_encode($_a)}

Please sign in to leave a comment.
Powered by Zendesk