There’re few ways to configure RS Documents for complete automation. Each method is equally effective just has different approach and/or limitation and may suit certain processes or needs better. If you would like to batch generate more than 20 documents at a time, please see section after Automation, Mass Batch Document Generation.

  1. Before you choose the method that you wish to configure automation with, your first step is to configure Document Action that will be executed with automation.  
  2. Follow the same steps for the Document Action configuration as you did for creating a custom button up until Email section (email section is optional):
  3. If you would like to configure Email section for Automation:
    1. Email File As: select how would you like it to be emailed: Attachment or Link.
    2. Email Action: select Autosend  (automation will not work with Preview).
    3. Email Template: email template Salesforce ID or merged code that stores Email Template Salesforce ID (for example:  you can have a formula field that dynamically set different email template ID’s based on different Opportunity types etc.).
    4. Email To: has to be Lead or Contact ID or merged field for Lead or Contact ID. For automation this field works a little different than from how you would set it up for manual button click. It will not work with auto-generated merged ID field that appears in Custom Button merge window for lookup fields (e.g. if you have a lookup field on your Master Object called Primary Contact, then in Custom Button merge window you may see 2 fields Primary_Contact__c and Primary_ContactId__c, even though you haven’t created specific ID field). You need to merge the ID field here as if you are merging it on your Google Docs template indicated through full relationship path. The easiest way to get that would be to save your Document Action, then click Edit Template Document and try to go through the path to get  Contact or Lead ID in the object and fields windows (as shown below), then copy generated merge code and paste it into Email To field. For example:  if you have a lookup field Primary Member on Opportunity, then you will merge ID as {!Opportunity.Primary_Contact__r.Id} from this path:
      Merge-Code
    5. Email CC, BCC, Additional: enter emails separated by comma, or merged field code for the field that stores email addresses.

Note: automation happens in future methods. This means that document generation runs asynchronously so it might be a few seconds late until you can actually see it completed. If you are testing automation after you trigger it, give it a minute and then refresh your page to see if it’s completed.