How to attach generated documents to a parent object

Problem:

Each time a DocGen Package is ran you’d like the generated document to attach to a parent object. For example, each time XYZ Non-Profit generates a receipt for a Contact they would like the generated receipt document to attach to the Account record.

Solution:

We will use an Insert-Update to attach the document to the desired parent object.
  1. Navigate to the DocGen Package and click the ‘New Insert-Update’ button.
  2. Set the Type drop-down to ‘Advanced’ to reveal additional fields on the page.
  3. Once the additional fields appear, set the Object Name drop-down to the parent object you would like to attach the generated document to. For our example we will use the Account object.
  4. Check-mark the Attach to this Object checkbox.
  5. Next, in the Field-Value Pairs drop-downs you will select the [Object] ID field. For our example the field is Account ID.
  6. In the empty text field enter the field tag for the object. Since our example is running from the Contact object and we would like to attach to the related Account field our field tag will be <<Contact_Account_Id>>. Below is our example Insert-Update:
  7. Lastly, navigate to your Delivery Option and ensure you check-mark the Allow Document Storage and Require Document Storage checkboxes. Additionally, select ‘Attachment’ in the Store As drop-down. Below is an example of our Delivery Option which will also email the generated document to the User’s email:

Outcome:

When you run the DocGen Package the document will now attach to the parent object.