Connecting S-Docs With Amazon S3

Setting Up S-Docs Amazon S3 Connection

S-Docs connects seamlessly with Amazon Simple Storage Service (Amazon S3), meaning that you can generate documents securely on the Salesforce platform and then upload them to an S3 bucket -- all without ever leaving Salesforce. This article will provide you with step-by-step instructions for configuring the S-Docs Amazon S3 connection. For the purposes of this guide, we'll assume that you have already created an Amazon S3 account and an Amazon S3 bucket.

Note: This connection supports uploading documents to one S3 bucket at a time. To change buckets in the future, you will need to resubmit your Amazon S3 credentials.

Provide S-Docs with Your S3 Credentials

To allow S-Docs to upload documents to your S3 bucket, you first need to provide S-Docs with your Access and Secret keys, the name of the bucket you want to store documents in, and your bucket region.

Note: Your bucket must allow public access settings for this connection to function properly.

To do so, navigate to the Amazon S3 Integration page. If you are using S-Docs 4.381+, do so by clicking the App Launcher, typing in "S-Docs," and clicking S-Docs Setup.

From the S-Docs Setup page, scroll down to the Other Pages section and click Go To AWS S3 Integration Page.

If you are using a version of S-Docs below 4.381, navigate to this page by clicking one of the following links:

[Production]: https://login.salesforce.com/apex/SDOC__SDConfig?viewS3Settings=true
[Sandbox]: https://test.salesforce.com/apex/SDOC__SDConfig?viewS3Settings=true

You'll be presented with the S3 Configuration page. Enter your S3 credentials, then click Submit S3 Credentials.

Note: The S3 Proxy URL field is not required. This field is for routing traffic to your S3 buckets through your F5 gateway proxy URL.

You will receive a success message when your credentials are successfully submitted. You can exit the page at this time.

Create a Remote Site Setting

Next, you need to create a new remote site setting for your Amazon bucket's virtual-hosted-style URL.

From the setup menu, type "Remote Site Settings" into the Quick Find bar, click Remote Site Settings in the dropdown menu, then click New Remote Site.

Give your remote site a unique name; we recommend something similar to AmazonS3Connection.

Then, enter your bucket's virtual-hosted-style URL. These URLs follow the following format:

https://my-bucket.s3.region.amazonaws.com

Since our bucket is named accountsummaries and our region is us-east-2, our remote site setting looks like this:

Ensure that the Active checkbox is checked, then click Save.

Add the Amazon S3 Enabled Field to the Template Detail Page

To specify which templates can be uploaded to Amazon S3, you need to add the Amazon S3 Enabled checkbox field to your template record detail page. From the setup menu, navigate to the Object Manager and find the SDoc Template object.

Navigate to the Page Layouts tab and click Edit for the SDoc Template layout.

Find the Amazon S3 Enabled field in the Fields section of the layout editor. Drag it down into the SDoc Template Detail section. Then, click Save.

Upload Documents to S3

To enable a template for upload to Amazon S3, simply check the Amazon S3 Enabled checkbox on the template detail page.

When you generate this template, you'll now see an Upload Selected Documents to S3 button on the Generated Documents page.

You will receive a success message when your document is successfully uploaded.

Note: The document will be both uploaded to S3 and saved in the S-Docs related list on your base record. If you don't want your documents to be saved in Salesforce, you can configure a trigger that removes them when they are sent to S3.

Automatically Uploading Documents to S3

Although the default S-Docs & Amazon S3 connection allows you to choose whether or not a document should be uploaded to your S3 bucket, you can also modify this configuration so that documents are automatically uploaded to S3 whenever they are generated. To do so, simply modify your S-Docs button URL and add the autoS3='true' parameter to the end. For example, an S-Docs Account button with the automatic S3 upload feature would look like this:

{!URLFOR('/apex/SDOC__SDCreate1', null,[id=Account.Id, Object='Account', autoS3='true'])}
Note: Documents generated via automation (S-Docs Jobs) that have the S3 Enabled field checked will always be uploaded to Amazon S3 after generation. This includes documents generated with the S-Docs Mass Merge (batch) feature.

Tags: , ,

Was this helpful?