File/Attachment Sync (Free)
File/Attachment Sync takes files that are uploaded to Salesforce Files or Salesforce Attachments and syncs them with S-Drive for the selected object. Sync is processed based on a queue, so new items will appear in S-Drive in a few seconds/minutes. Attachments are normally only used in Salesforce Classic.
After configuring File/Attachment Sync, any new file/attachment uploaded to Salesforce, will be uploaded to S-Drive automatically. You can also configure it to delete the Salesforce files/attachments after successfully syncing to S-Drive.
To sync file/attachments to S-Drive, click the "configure sync" button on the Micro Services tab. You will then see the page below.
![image-20240115-210202.png](../__attachments/2134607414/image-20240115-210202.png?inst-v=45374f53-f4b0-4a30-83dc-edc14e9d1f8c)
Synced Objects settings
Object File For each Object for which you want to sync files or attachments, select the S-Drive file object you want to use for syncing from the dropdown list There will usually only be one choice.
Object File Relationship Enter the API name of the field that relates to the parent object. For the S-Drive File Objects that come bundled with S-Drive, these will be cg_Account__c, cg__Case__c, cg__Contact__c, cg__Lead__c, cg__Opportunity__c. For S-Drive file objects created by you (those that didn't come standard with S-Drive), it will normally be Parent_c.
Synch Attachments, Sync Files Check the checkboxes to indicate whether you want to sync files, attachments, or both.
Delete Files After Syncing If you’d like to delete the underlying Salesforce File after syncing, check this box for that object.
Excluded File Types for Delete After Sync (Files only) If there are files of certain filetypes that you want to exclude from deleting after sync, you can list those in the next column.
Behavior of “Enable to Delete Files/Attachments after Upload”
The Salesforce file will be deleted from the record it’s synced to.
It will also be deleted completely from Salesforce, saving storage, except in the following circumstances:
If the file is shared to records on other objects, but not configured to sync, the file will remain on those records and not be deleted from Salesforce.
If the file is shared to Chatter groups, it will not be deleted from Salesforce.
If the file is shared with other users or came from an email, but is not shared to other records or groups, it will be completely deleted from Salesforce.
General Settings
Handle Email Files/Attachments Choose whether to sync files attached to incoming emails.
Update Feed posts/comments containing files to declare that the file has been synced to S-Drive for files that are deleted after syncing When files are synced from Chatter and then deleted after sync, the files disappear and users may not know where to find them. Check this box if you want a message to appear in the chatter post explaining that the file has moved to S-Drive.
Sync Status
This section shows the number of failed syncs and syncs that are in progress.
File Sync and Attachment Sync use the AttachmentSync object. AttachmentSync records are created and then deleted once the sync is complete.
If you have failed or hung AttachmentSync records and you delete them manually while “Enable to Delete Files/Attachments After Upload” is checked, you may lose files that were not yet synced to S-Drive. If you wish to delete old AttachmentSync records, first uncheck “Enable to Delete Files/Attachments After Upload.”
Configure File Sync of Pre-existing Files
If you click the button here, you’ll be able to sync Salesforce files that existed before File Sync was enabled. You’ll see the page below after clicking the “Go” button.
Select the File Object you want to sync and check the “create” checkbox.
![](../__attachments/2134607414/image-20210514-174135.png?inst-v=45374f53-f4b0-4a30-83dc-edc14e9d1f8c)
A note about Permissions
File Sync and Attachment Sync use a callout to sync the file or attachment to S-Drive. So you must configure the outbound message user correctly:
Check Setup>outbound Messages for the following 3 items
AttachmentSync
FileSync Callout
Preview Callout
Check the "user to send as" profile. It must have
Customize Application permission
Send Outbound Messages permission
Query All Files permission (which can only be applied using a permission set.)
Users who upload files that will be synced must also have
Attachment Sync object profile permission (read/create/edit + field accessibility)
Send Outbound Messages permission.