Using The S-Docs Create Salesforce Attachment / Create Salesforce File Settings

By default, S-Docs are saved as Salesforce Attachments in the Notes & Attachments related list on your base object record each time you generate a document. To change this setting, all you have to do is open up the template editor for the template(s) you wish to edit, then open up the Document Options tab.

You can configure attachment and file settings under the Attachment & File Options section.

Create Salesforce Attachment and link to record is checked by default. This option creates Salesforce Attachments in addition to the S-Doc record each time this template is generated going forward. Checking this option again after it has been unchecked will not create attachments for previously created documents.

You can also opt to create Salesforce Files each time this template is generated. For more information on Attachment and File Options, please view the Document Options section of the Template Editor Overview.

Querying Attachments or Files Created By S-Docs

You may need to query just the Salesforce Attachments or Files that are generated by S-Docs. This can be accomplished using the Description field on the ContentVersion object. Whenever S-Docs creates a Salesforce Attachment or File, the Description field on ContentVersion is populated with the record ID of the corresponding S-Doc record (SDOC__SDoc__c).

This can be useful if, for example, you have a required custom field on the ContentVersion object. To avoid errors when S-Docs creates a Salesforce Attachment or File, you can create a trigger that populates that custom field on any Salesforce Attachment or File that S-Docs creates.

The following trigger will populate the custom required ContentVersion field Required__c for Salesforce Attachments or Files created by S-Docs:

Attachment Discussion

There are advantages and disadvantages to using Salesforce Attachments. On one hand, attachments are more permanent, faster to view, and can be exported for archiving or for legal/compliance purposes. Attachments also aren't affected by future template changes, whereas regular S-Docs use the template record each time they are viewed.

On the other hand, the attachment record itself cannot be easily related to multiple records (you should leverage the S-Docs Relationship for this) and attachments can consume a significant amount of file storage space within Salesforce. You also cannot easily report on data located within an attachment. S-Docs lets you choose whether you want to enable attachments or not on a per-template basis. We typically recommend you keep this feature enabled.