1. Another method that can be used to generate documents is the one executed from Process Builder. You can use this method to trigger Document Action on any standard or custom objects.
    1. NOTE: If you are using Process Builder automation and want to be able to configure document action to also send an email, see this use case article for more information and how to enable batch mode.
  2. If you have not use Process Builder before, learn more about it here. With Process Builder you can configure your process to complete a simple action, or complete multiple actions at once, including time based updates, field update, flow execution and more. It’s a very powerful and user-friendly tool that allows you to create and configure most of the processes without writing any code.
  3. To use Process Builder to setup automation follow the following steps:
    1. Create a New Process.
    2. Select Object and Start the Process option as desired.
    3. Define criteria for Action Group. Here you can enter a criteria that will trigger your Document Action, for example you want to setup automation to send out a contract when Opportunity is Closed Won, then in this step you will set criteria for Opportunity Stage = Closed Won. You can create multiple action groups in the same process and trigger different Document Actions based on different criteria.  
    4. Add Immediate Action for Document Action execution:
      1. Action Type: Apex
        (NOTE: If you want to configure document action to send an email with Process Builder, refer to this article. Or if you want to batch generate over 20 documents at once, refer to this article).
      2. Apex Class: Generate Document
      3. Under Apex Variable you will see 2 required fields:
        1. Document Action ID: you can set a string, such as Document Action ID autonumber (e.g. GDT-000002) or Salesforce ID of the Document Action (either one will work) OR reference of the field that stores one of those values (maybe you have a formula field that sets different Document Action ID based on certain criteria).
        2. Record ID: Reference – Record ID of the Master object, so if your process is executing from Opportunity then it will be Opportunity ID.
      4. Optionally you can click “Add Row” and set Error Field to be any text field you wish on your object. If you are creating a Process on a Custom Object we recommend  that you previously create a text field called something like “Document Automation Error” and then map it in this step. Even though it’s not required, it can be helpful in case something prevents Document Action to execute, so you can see what the error is and fix it.