Skip to main content

Salesforce Document Management And Attachment Export Made Easy

Document Madness

As Salesforce has expanded its reach beyond CRM over the past 15 years, its document management capabilities have kept pace. Many businesses use Salesforce to attach various types of documents to specific records, right out of the box. With built-in support and compatibility with third-party tools like Docusign, Salesforce simplifies the process of uploading and streaming documents for end users.

But what if your document library grows and suddenly you find yourself needing to batch-process, transfer, or migrate these files? You might end up down a technical rabbit hole, exploring Salesforce’s data models, APIs, and a plethora of third-party tools, all without finding a straightforward way to extract your documents from Salesforce.com.

We had 4 key requirements that led us to create our own solution:

  1. We needed to select and tag a finite number of salesforce records for which documents existed
  2. We needed to select specific file types
  3. We required only the latest version of documents
  4. We needed to rename and prefix the files with data from the salesforce record and organize the files into sub folders.

How do we make Exporting Salesforce Documents Easy?

In my mind, simplicity is the level of effort and friction to get my desired outcome. In my case, I chose Azure DataFactory due to my experience and success building data pipelines. Configuring document migration in Azure Data Factory is still a few hours of work, but the level of effort to execute the migration is a single click. This article explores the complexities you need to understand before embarking on a Salesforce document migration.

Understanding Salesforce Attachment vs ContentDocument

When you’re in the trenches of Salesforce’s data architecture, trying to extract documents, you’ll encounter two main objects: Attachment and ContentDocument. These objects function differently when it comes to extraction, and understanding their nuances is crucial for a smooth operation.

Attachments are straightforward but limited. If your documents are stored as Attachments, you’ll likely need to perform a record-by-record extraction via Salesforce’s API. This is because each Attachment is directly tied to a single Salesforce record. It’s a one-to-one relationship, which makes extraction easier.

In contrast, ContentDocument is part of Salesforce’s more modern and robust Files architecture. It allows for file versioning and can be associated with multiple records via the ContentDocumentLink junction object. However, it’s not all smooth sailing here either; Salesforce restricts your ability to perform bulk queries and downloads of ContentDocument objects. You may have to employ more sophisticated methods including code or third party tools.

Overcoming Key Limitations for Managing Salesforce Document Metadata

Query All Files in Salesforce

Salesforce by default, limits your ability to query and extract metadata for all of your documents. To query all files, your salesforce admin needs to add a permission set. This article explains step by step how to Query All FIles to obtain a complete list of your documents.

With this data, you technically have all of the medata you need to start downloading files. The problem is that unless you have configured the ParentId to associate your documents with another object, you lose context to what that document is related to. In other words, you could download your vendor invoice but have no data to know what customer or deal that invoice belongs to.

ContentDocumentLink is the Missing Link

To connect your Salesforce documents to the parent record, Salesforce has a junction object called ContentDocumentLink. The problem is salesforce does not allow you to query and download all of the records in bulk.

To solve this problem, I employed Azure data factory to obtain all of my documents, select only the document records I care about, then one by one query and fill a database table with all of the ContentDocumentLink records. At this point, to make my life simple, I appended the additional data points I would use to ultimately rename my files and sub folders from the parent Opportunity record.

Bulk Download Salesforce Documents

With a database table containing all of my DocumentAttacmentLinks + ContentDocument records, built an Azure DataFactory flow that used the Salesforce REST API to GET each file 1 by 1 and loaded it into Azure Blob Storage. I could have loaded it into another storage solution like Google Drive but opted to keep it in Azure.

Are you Bulk Exporting Documents and Attachments?

We are always looking for better and faster ways to get data in and out of Salesforce. If you have another third party tool or process makes this faster and easier we would love to work with you!

If you need help offloading the effort to get your documents and attachments out of Salesforce, feel free to book a meeting with us.

Ultimate Salesforce and Snowflake Guide on Salesforce Ben

Salesforce Ben

This week Ryan released a guide for Salesforce and Snowflake on Salesforce Ben. Salesforce Ben is the leading independent Salesforce.com community and authority on all things Salesforce.com.

Snowflake and Salesforce is a perfect marriage of cloud business applications and cloud data platform to turn data into information. Salesforce has built a powerful first-class integration within Salesforce Data Cloud that is the most advanced of any third party connectivity

If you are currently using Salesforce Data Cloud or Salesforce Tableau CRM this article is for you. Additionally, while at SnowflakeSummit2023, we saw some incredible Salesforce Data Cloud enhancements for Snowflake that will be game changing for enterprise cusetomers.

We can’t wait to write about upcoming zero copy feature from Salesforce to Snowflake. Included in our article is step by step tutorials how to integrate Salesforce with Snowflake to day. Should you have any questions how these capabilities apply to your enterprise or how Snowflake can advance your Salesforce analytics, we are here to help!

How my Snowflake Powered Lead Distro Test Turned Out to be Reverse ETL

Snowflake Cloud Data Pipelines for Reverse ETL

A year ago, I worked on a small project to help us improve our data driven funnel. I learned what I called “Snowflake to Salesforce analytics sync” had a more buzzworthy term called “Reverse ETL.” This article shares some of the lessons learned along the way and some thoughts about where reverse ETL is headed.

Low Level of Effort Solution

All of the data and metrics were already available and calculated in Snowflake for reporting, so the process to push those measurements back into a Salesforce object using Azure Data Factory was quite simple.

The transformation work was prepared using Datameer on top of Snowflake which I had previously written about: Slice Through your Snowflake Data like a Buzzsaw with Datameer

3 Common Salesforce.com Data Migration Issues to Avoid

Salesforce data migration pitfalls

Data migration can be a complex process, especially when moving to a new system like Salesforce.com. In this article, we’ll explore 3 common Salesforce.com Data Migration Issues that you should avoid at all costs. Whether it’s poor project planning, communication gaps, or lack of engagement from business stakeholders, these challenges can all contribute to a less-than-successful migration. But with the right approach, Salesforce.com Data Migration can be a smooth and efficient process.

Issue 1: Poor project planning and expectations

One of the biggest challenges of Salesforce.com Data Migration is poor project planning and expectations. Without clear communication and process gaps between the Salesforce development, business, and data migration teams, a successful migration becomes less likely. In order to avoid this pitfall, it’s important to establish crystal clear expectations between all parties involved.

  1. Salesforce team and data migration specialists need to communicate changes to the Salesforce.com data model in the final weeks leading up to go-live. This sets best practices for managing Salesforce and prevents un-intended, time consuming issues.
  2. Data migration specialists and business stakeholders need to agree what data is migrated from the old business app into Salesforce.com. In some cases this mapping exercise will surface missing fields or functionality.
  3. Delivery team and business stakeholders should work together to ensure training occurs with real data if you are moving your entire process from an old system into Salesforce.com.

Issue 2: Attempt to fix too many data quality while moving data

When migrating data from one business application to another, such as Salesforce.com, it is important to address any data quality issues that may have been previously ignored. This is because automations and validation rules in the new system may highlight these issues. To ensure that the data migration process is as smooth as possible, it is best to perform extensive data quality adjustments in the source system or after the data has been migrated.

Additionally, Salesforce.com offers a vast ecosystem of solutions and apps, one of which is Cloudingo, which can be a valuable tool for data cleanup during migration. By cleaning the data at the source or after migration, you can ensure that the data is accurate and consistent in your new system.

Issue 3: Manual, human initiated data movement

If your Salesforce.com developers or consultant suggests using DataLoader and Excel for your data migration, it is important to keep in mind that this approach is definitely not be suitable for complex migrations. It is crucial to thoroughly test the migration process in a sandbox environment, running end-to-end migration many times before migrating to production. With that said, you also shouldn’t need to spend a lot of money on technology to migrate your data. Here are some free data tools for Salesforce.com that you can share with your tech team.

Have a Salesforce Data Migration Blueprint for Success

There are lots of resources on the web including the ones we provide for free. Here are key components that you should build into your own successful data migration plan.

  • Project timeline + milestones
    Having clear milestone and working backwards from “go-live” no less than 6 weeks will help you avoid under-scoping your data migration into Salesforce.com.
  • Data migration object inventory
    Scorecard to track and report progress and issues through the entire migration lifecycle
  • Data mapping docs
    Excel / Google Sheets with data mapping and definitions is how a lot of data mapping gets complete. Now we are working on Data Tools Pro free utility to help with the work.
  • End to end migration checklist
    Complete, documented data migration checklist of all steps that need to occur for migration.
  • Business continuity plan
    Not typically a part of data migration but something that helps align expectations for what happens on day 1. There are no-redos on migration once users start updating data in Salesforce.com.

Need Help Planning ?

Our Salesforce.com migration Blueprint and Services are designed with these common issues in mind.

We have a free assessment and checklist to guide you down the path to success!

Salesforce Data Migration Plan to Success

Salesforce Data Migration Tool Review

Salesforce DevTool Chrome extension provides ERD and

Free Salesforce DevTool Extension for Chrome

Salesforce DevTools extension for Chrome is by far the most useful Salesforce data migration tool for administrators looking to inventory objects and fields. For data migrations in particular this tool has been so valuable as a time saver and provided foundation and inspiration our own Salesforce Migration tools.

Generate Salesforce Relationships Diagrams (ERD)

In DevTools, similar to exporting an Excel file, you can also export a Salesforce ERD, giving you an entity relationship diagram with a few clicks.

Download Salesforce Fields to Excel

In DevTools, you can search and select a list of objects, then download the field definitions directly to Excel.

Salesforce.com entity relationship diagram generator

Workbench: Great for Salesforce Data Migration

Workbench for Salesforce.com is a very useful free that offers the most functionality for working with Salesforce data. With a variety of administrative functions you can execute a wide range of tasks including but not limited to

  • Testing SOQL queries
  • Explore your data model
  • Explore the Salesforce Rest API
Salesforce workbench allows you to query and test APX

Workbench Trick: Mass Delete Records in Salesforce

Inside of Workbench, you can run APEX code, so one helpful trick is deleting data from a SOQL query which opens the door to not only delete more than the 250 cap but more importantly allow deletion of records for custom objects.

Here is an example code snippet shown above that would delete 10,000 accounts where we can specify any conditions like records created after 11-20-2022.

delete[SELECT id FROM Account WHERE CreatedDate > 2022-11-20T01:01:01Z LIMIT 1000];

Need more Salesforce Data Migration Tool Recommendations?

We are here to help provide recommendations for free and premium solutions to move salesforce.com data into Salesforce.com. Feel free to check out our Salesforce.com Migration Assessment for to lean on our experience.