Skip to main content
CRMSalesforce CRM

Open Classic Single Mail Merge from Lightning

By December 27, 202013 Comments

While you can switch to Classis Salesforce and use the Mail Merge functionality from there, you can easily add a custom button to the Account or Contact object layout to open within Lightning.

First navigate to the Object Manager and choose the object you will add the button on.  For this example we will use the Account Object because our templates are populated with fields from here.

  1. Select Buttons, Links, and Action from the list on the left and click the New Button or Link
  2. Label the button ‘Mail Merge’ and choose Detail Page Button.
  3. Select Display in new window as the Behavior and URL for Content Source.
  4. Copy the following into the text box:


NOTE:  Replace <YOUR_ORG_NAME> with the name of your organization when logged into Salesforce Classic and Lightning.  Remove any spaces from the hyperlink after copying

  1. Click Save.

Navigate to the object’s layout(s) to add the button to the page.

  1. Select Mobile & Lightning Actions from the list on the left and drag the Mail Merge button to the Salesforce Mobile and Lightning Experience Actions

  1. Click Save and test your button. When you click on the Mail Merge button from the Account Page the Classic Mail Merge page will open.  Choose the desired template to merge and perform as usual.

Becci MG

Author Becci MG

More posts by Becci MG

Join the discussion 13 Comments

  • Tim Osborn says:

    This is a very helpful article. I’m wondering if you have found a way to mass mail merge Opportunities? I’m helping a small non-profit that could use that functionality.


    • Becci says:

      Hi Tim,

      Here are some ways to do Mass Document Mail Merges:

      1. Can be done with apex code similar to Send List Mail.
      2. Visual Force pages that open in Word with an apex data controller can be used.
      3. Some will export the data they need from a SF report to Excel and then create Word merge documents with the Excel sheet as the source.
      4. If the office is using the latest Office 365, they may be able to connect directly to Salesforce from Excel for the Data Source.
      5. There are some free Excel Addins for Salesforce (e.g., XL Connector) that can be used for the Data Source.
      6. There some ODBC drivers for Salesforce (e.g., Devart) that can used as the Data Source.

      I hope that helps,


      • Bosh says:

        Always Chrome. Got it to work, but an issue with Person Accounts. It will merge properly on Business Accounts (which is the original Record Type), but not merging for Residential Accounts (which is the Record Type created for Person Accounts). Not sure why this would cause a problem.

        • Becci says:

          That’s great! Person accounts will work differently to get the names and information into the template. I have found the best way is to put a lookup field on the Household Account for the Person records that you need. For example the primary person on the Household. That way you can get the fields you need by using Account.PersonFieldName__r.Name or Account.PersonFieldname__r.billingaddress. into the template.

          I hope this helps :-).

  • Mary Beth LeMay says:

    HI Becci

    I’m getting the following error when I test the button. Got any idea how I fix this? I checked the syntax in the box and it says it’s fine

    Mary beth

    Invalid Page Redirection
    The page you attempted to access has been blocked due to a redirection to an outside website or an improperly coded link or button. Please contact your Administrator for assistance. For more information, see Insufficient Privileges Errors.

    Click here to return to the previous page.

  • Eva says:


    This is useful and I’m testing it in the sandbox environment. The problem we have is that I get the “Unable to Access Page” message.

    You are missing information needed by the page you have attempted to access. If you believe this is an error, please refresh your screen. If the error persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information.

    Do you know what the issue is?

    • Becci says:

      Hi Eva,

      Are you putting the Sandbox URLs in the script or the production URLs? If the former, try it with the Sandbox URL instead. If the latter, make sure you have forwarding enabled in the Org so it will allow you to go to a difference URL. MyDomain settings could also effect it if Production is using it and Sandbox is not.

      I hope that helps,

  • Eva says:

    Hi Becci,

    I’ve replaced it all with the sandbox URLs. It seems like I get that error message if the “Log an Activity” checkbox is checked off. This is also for the mail merge on Cases.


    • Becci says:

      Hi Eva,

      I am not sure as I have not tested in Sandbox and whether all would work there. If it works with check box unchecked then you may not be able to create history using this method. If the code is not working at all, feel free to post it and I can look at it.

      You can also try testing in Production as there may be a limitation in Sandbox.


Leave a Reply

Skip to content