Back

Integrating Salesforce Files: A Guide to Internal and External Links

How-to Guides and Tutorials
15 min
Salesforce Guide to Internal and External Links_cover

Managing Salesforce files is more tricky than it seems, even for experienced developers and admins. Yet, the skill is vital for navigating the Salesforce ecosystem and using its capabilities to the fullest extent. 

In this post, experts from Synebo, a licensed Salesforce development agency delve deeper into integrating Salesforce files with internal and external links. This elaborates on our past blog about the basics of Salesforce files. It is assumed that you are familiar with the basic architecture of SF Files, the basic objects, and their relationships. 

From this post, you’ll discover technical aspects of internal and public link generation, as well as discover security and compliance aspects related to handling Salesforce files. 

Salesforce Internal Link Generation

Among the most used internal links in Salesforce are preview and download links. They can be used in various ways: in custom UI components to embed links for quick file previews or downloads, in hyperlink formula fields to create clickable URLs to navigate to related records or files, in email templates to direct recipients to specific Salesforce records or files, and in reports and dashboards to provide easy access to detailed records. These links enhance navigation, efficiency, and user experience within Salesforce.

Let’s get to know how to create custom preview and download links and when to use different link conditions: 

Crafting Custom Preview Links

A preview link can be created using the following template:

/sfc/servlet.shepherd/version/renditionDownload?rendition=<rendition>&versionId=<version>

<version> — should be replaced by the Id of the specific ContentVersion

<rendition> –- more tricky and unfortunately not very well-documented url parameter. 

Research and experiments have shown that the available options for this parameter can be as follows:

  • SVGZ. Previewing for the compressed SVG files, which is a vector graphic image file extension that contains scalable images.
  • THUMB120BY90. Thumbnail preview with image resolution 120 x 90
  • THUMB240BY180. Thumbnail preview with image resolution 240 x 180
  • THUMB720BY480. Thumbnail preview with image resolution 720 x 480
  • ORIGINAL_<File_Extension>. <File_Extension> should be replaced by the file extension. Previewing a file in its original resolution.

Obviously, a preview link may not be generated for all file types, but only for those that the Salesforce platform can show. In case the platform fails to generate a preview of any file – the generated link will open a blank page or give an error as shown below. 

top.location=’https://<DomainName>.my.salesforce.com/ex/errorduringprocessing.jsp

You may be additionally interested in exploring how to create data extensions in Salesforce. 

Why Different Preview Link Renditions Might Be Needed

Different preview link renditions are useful for various scenarios to ensure that the content is displayed appropriately based on the context. Here are some examples of use cases for each type of rendition mentioned:

#1 SVGZ

  • Use Case: Displaying vector graphics in reports or dashboards where scalability without loss of quality is crucial.
  • Example: A custom UI component displaying company logos or detailed diagrams that need to maintain high resolution at any size.

#2 THUMB120BY90

  • Use Case: Providing a quick, low-resolution preview of files in a list or gallery view.
  • Example: Showing small thumbnails of uploaded images or documents in a custom file manager within Salesforce, helping users quickly identify the content without loading full-sized images.

#3 THUMB240BY180

  • Use Case: Offering a slightly larger preview that provides more detail than the smallest thumbnail.
  • Example: Displaying previews in a grid layout where users need to see more detail than the smallest thumbnail but still prioritize quick loading times.

#4 THUMB720BY480

  • Use Case: Displaying a high-resolution preview for detailed examination without downloading the full file.
  • Example: Showing previews of high-quality images or detailed documents where users need to view the content in more detail, such as in a custom document library.

#5 ORIGINAL_<File_Extension>

  • Use Case: Allowing users to view the file in its original resolution and format.
  • Example: Providing a full-sized preview for presentations, PDFs, or images where original quality is essential, such as marketing materials or detailed reports.

By offering different renditions, you can optimize the user experience based on the specific needs of each use case, ensuring that previews are both functional and efficient.

Strategies for Efficient Download Links

A download link can be created using the following templates:

#1 Version template

/sfc/servlet.shepherd/version/download/<version>

<version> — should be replaced by the Id of the specific ContentVersion

Use case: When you need to provide access to a specific version of a file.

Example: Allowing users to download the latest version of a product brochure or a specific version of a contract.

Potential pitfall: Ensure the ContentVersion ID used is correct and accessible to the user.

#2 Document template

/sfc/servlet.shepherd/document/download/<document>

<document> — should be replaced by the Id of the specific ContentDocument

Both of the link templates shown above provide the option to download a file.

The following link template gives us the ability to download multiple files as a single ZIP archive.

/sfc/servlet.shepherd/version/download/<version1>/<version2>…

<version> parameters should be replaced by the Ids of the specific ContentVersions. Can be added numerous of ids separated by “/”. 

Use case: When you want to provide access to the most recent version of a document regardless of versioning.

Example: Providing a link to download the most recent company policy document.

Potential pitfall: The ContentDocument ID must be correct and users must have access to the document. If there are multiple versions, ensure users understand they are getting the latest one.

Looking for Salesforce consulting services? Let the Synebo team assist you with our diverse expertise and experience. 

Expanding External Public Link Capabilities

In this part of the article, we will look at ways to get a public link to a file. This way, you can use the file link without logging into Salesforce.

Generating Public Links via Salesforce UI

From the UI perspective, it can be done using the “Share” button on the specific file.

Salesforce files

Here’s the procedure:

#1 Open File Sharing Settings:

  • Click on the file you want to share.
  • A Salesforce settings window will open.

#2 Access Link Options:

  • Click on the “Who can access” option.
  • Additional settings will appear, including the “CREATE PUBLIC LINK” section.

#3 Set Expiration Date and Password:

  • You can set an expiration date for the public link.
  • You can also set a password to add an extra layer of security.

#4 Create or Copy the Link:

  • If a public link was previously created, the field will be filled in. You can simply copy and use it.
  • If no link exists, the field will be empty. Click on the “Create Link” button to generate a new one.

#5 Confirm Creation:

  • A warning modal will appear, informing you that the link will allow anyone to access the file.
  • Confirm to create the link.
Salesforce files

Here are the implications of each setting when creating a public link

  • Expiration date. Limits the duration the file is accessible via the public link. Ensures temporary access, reducing the risk of unauthorized long-term access.
  • Password protection. Adds an additional layer of security by requiring a password to access the file. Enhances security, especially useful for sensitive documents.
  • Pre-existing public link. Indicates that a public link has already been created, allowing for easy reuse. Prevents the creation of multiple public links for the same file, simplifying link management.
  • Creating a new public link. Allows the generation of a new public link if none exists. Provides flexibility to share the file with new recipients or contexts.

That’s it about creating a public link in the UI. But the more interesting question is what the Salesforce platform handles for us, and what is going on under the hood in the described process. In a nutshell, the Salesforce platform creates an instance of a ContentDistribution object. We’ll look at this object in more detail in the next parts of this article.

Looking for Salesforce integration services or Salesforce implementation services? The Synebo team is ready, willing, and able to assist you. 

The Role of the ContentDistribution Object

In this part of the article, we will talk about the ContentDistribution object as the main object that is responsible for handling public links. In the previous paragraph we described how to create a public link from the UI without any code, now let’s dive deeper into the programmatic manipulation of it. So, let’s start from relations. 

When you create a ContentDistribution object, you must populate references to specific ContenDocument and ContentVersion objects by filling in the ContentDocumentId and ContentVersionId fields. In addition, you can link the created record to an Account, Campaign, or Case using the RelatedRecordId polymorphic field. 

Key Fields

  • ContentDocumentId: This field references the ContentDocument object and links the ContentDistribution to a specific document.
  • ContentVersionId: This field references the ContentVersion object and links the ContentDistribution to a specific version of the document.
  • RelatedRecordId: This polymorphic field can link the ContentDistribution object to an Account, Campaign, Case, or other standard/custom objects.

It’s essential to keep a few things in mind.

You can set several additional properties when creating a ContentDistribution object:

  • Password
  • ExpiryDate

The following preferences have a default value of true

  • PreferencesAllowPDFDownload 
  • PreferencesAllowOriginalDownload 
  • PreferencesNotifyOnVisit 
  • PreferencesLinkLatestVersion
  • PreferencesAllowViewInBrowser

The whole list of available preferences can be found in the Documentation

Therefore, from my point of view, it is better to manage it explicitly.

  • At least one of the preferences must be set for the created ContentDistribution, or you will fail with an error: “MISSING_ARGUMENT, You must specify at least one delivery option.: []”

Here is a sample code for creating a ContentDistribution record:

ContentDocument contentDocument = [SELECT LatestPublishedVersionId

                                   FROM ContentDocument

                                   WHERE Title = 'Content for delivery'

                                   LIMIT 1];

ContentDistribution contentDistribution = new ContentDistribution(

Name = 'Test content delivery',

ContentVersionId = contentDocument.LatestPublishedVersionId,

PreferencesAllowViewInBrowser = true,

PreferencesAllowOriginalDownload = true,

PreferencesAllowPDFDownload = false,

PreferencesNotifyOnVisit = false

);

Database.insert(contentDistribution);

Automated Management of Public Links

That’s pretty much it. Once you have created a ContentDistribution record with the required delivery parameters, you can query it for the generated urls:

ContentDistribution contentDistribution = [

SELECT DistributionPublicUrl,

       ContentDownloadUrl

FROM ContentDistribution

WHERE Name = 'Test content delivery'

LIMIT 1

];

The result DistributionPublicUrl will looks like shown on screen bellow:

Salesforce files

 

Notice that the Download option appears in the top panel. This is due to the PreferencesAllowOriginalDownload flag, which we set to true.

To summarize the above, once the ContentDistribution object is created, the Salesforce platform, depending on the parameters you set, will generate 3 public links that you can query and use:

  • DistributionPublicUrl – main URL of the link to the shared document.
  • ContentDownloadUrl – the link for downloading the file.
  • PdfDownloadUrl – the link for downloading the file as a PDF.

Salesforce files functionality is utilized fairly often. For example, in one of our past cases, the Synebo team helped with help center development and integration, we used this functionality. 

Security and Compliance Considerations

Now, let’s get to know better aspects related to security and compliance of file sharing in Salesforce. 

Security Best Practices for File Sharing

When sharing Salesforce files, it’s crucial to follow best practices tailored to the needs of your business environment.

#1 Small Business:

  • Limit access: Use role-based permissions to restrict access to Salesforce files only to those who need them.
  • Enable MFA: Multi-factor authentication adds an extra layer of security to user accounts accessing Salesforce documents.
  • Use audit trails: Monitor and log file access and sharing activities using Salesforce’s audit trail feature to track Salesforce file sharing.

Implementing these practices helps ensure that Salesforce file management remains secure and efficient in a small business setting.

#2 Enterprise:

  • Data Encryption: Encrypt files in Salesforce both at rest and in transit to protect sensitive information.
  • Advanced permissions: Implement fine-grained salesforce file sharing settings to control access at a detailed level.
  • Regular audits: Conduct periodic security reviews and audits to ensure compliance and identify potential vulnerabilities in Salesforce file management.

By adopting these advanced practices, enterprises can significantly enhance the security of their Salesforce documents and mitigate risks.

Compliance and Salesforce Files

Managing Salesforce files requires adherence to various compliance regulations to protect sensitive information.

GDPR

  • Data Protection Impact Assessments (DPIAs): Conduct DPIAs for data processing activities involving Salesforce files to assess and mitigate risks.
  • Right to access and уrasure: Ensure that mechanisms are in place to quickly respond to data subject requests regarding their Salesforce documents.

Ensuring GDPR compliance for Salesforce files helps protect user data and avoid hefty fines.

HIPAA

  • Data Security: Implement administrative, physical, and technical safeguards for Salesforce files containing PHI (Protected Health Information).
  • Breach Notification: Have protocols for detecting and reporting breaches involving Salesforce file links.

Meeting HIPAA requirements is crucial for maintaining the confidentiality and integrity of healthcare-related Salesforce files.

Tools and features for ensuring сompliance

  • Salesforce Shield: Provides encryption, monitoring, and auditing tools to help maintain compliance with various regulations.
  • Field Audit Trail: Enables tracking changes to ContentDistribution object Salesforce, ensuring detailed historical records for compliance purposes.
  • Einstein Data Detect: Helps identify and protect sensitive data within Salesforce files integration to comply with regulations like GDPR and HIPAA.

Utilizing these tools ensures that Salesforce file management meets the necessary compliance standards effectively.

Looking for Salesforce development services from a licensed provider? The Synebo team must be your primary choice!

Final Take

Mastering Salesforce Files integration is essential for leveraging the platform’s full potential. This guide has covered the intricacies of generating internal and external links, emphasizing security and compliance. Whether crafting custom preview links or managing public access, understanding these technical aspects can significantly enhance file management in Salesforce. By following best practices and utilizing available tools, you can ensure secure and efficient file sharing, tailored to your business needs. 

Consider Synebo as your trusted Salesforce partner. We are a licensed provider, with more than 8 years of experience delivering Salesforce-based software solutions, integration, and more. Our team is widely recognized as experts. 

Contact Synebo to request Salesforce services for your project

FAQ
What is Salesforce Files Connect and how does it work?
Salesforce Files Connect allows seamless integration of Salesforce files with external storage systems, enabling users to access and manage all documents from within Salesforce. It enhances Salesforce file management by linking external data sources, making it easier to work with Salesforce documents.
How do I set up Salesforce Files Connect?
To set up Salesforce Files Connect, enable the feature in Salesforce file management settings, configure authentication providers, and create external data sources. Define Salesforce files integration with your storage system, and establish permissions for users to access these external files.
What are the benefits of integrating external storage systems with Salesforce?
Integrating external storage systems with Salesforce files offers centralized access to all Salesforce documents, enhances collaboration through unified salesforce file sharing, and improves efficiency by reducing the need to switch between platforms for Salesforce files integration.
Can I manage file permissions for external files within Salesforce?
Yes, you can manage file permissions for external files within Salesforce. Salesforce file sharing settings allow you to control access, ensuring secure salesforce file sharing and maintaining the integrity of sensitive Salesforce files.
How can I share files from external sources within Salesforce?
You can share files from external sources within Salesforce by using ContentDistribution Salesforce. This feature creates Salesforce file links that can be distributed to others. The ContentDistribution object Salesforce helps in tracking and managing the salesforce file sharing process effectively.
Table of content
The Complete Guide to Salesforce ISV Partners: Advantages and How to Become One Salesforce Internal Link Generation Expanding External Public Link Capabilities Security and Compliance Considerations Final Take
articles You might be interested in
Best Salesforce Adoption Strategies for Success
18 Jul 2024
How-to Guides and Tutorials
Top Salesforce Adoption Strategies for Business Efficiency
Yana Chekan
Yana Chekan
15 min
How to Build Custom Salesforce Apps Without Coding_ A Step-by-Step Guide
11 Jul 2024
How-to Guides and Tutorials
How to Build Custom Salesforce Apps Without Coding: A Step-by-Step Guide
Yana Chekan
Yana Chekan
16 min
Top challenges in implementing Salesforce and how to solve them
02 Jul 2024
Salesforce development
Top Challenges In Implementing Salesforce and How to Solve Them
Sergii Romashov
Sergii Romashov
11 min
Salesforce Data Management Best Practices: What You Need to Know
24 Jun 2024
Salesforce development
Salesforce Data Management Best Practices: What You Need to Know
Yana Chekan
Yana Chekan
13 min
Mastering Salesforce CRM Optimization_ Proven Best Practices
19 Jun 2024
Salesforce development
Mastering Salesforce CRM Optimization: Proven Best Practices
Yana Chekan
Yana Chekan
14 min
Ultimate Guide to Mastering Salesforce Automation Tools
17 Jun 2024
Salesforce development
Ultimate Guide to Mastering Salesforce Automation Tools
Sergii Romashov
Sergii Romashov
17 min
Prvoven ways to reduce Salesforce license costs
13 Jun 2024
How-to Guides and Tutorials
Salesforce License Optimization: Proven Ways to Lower Costs
Sergii Romashov
Sergii Romashov
15 min
Salesforce Guide to Internal and External Links_cover
12 Jun 2024
How-to Guides and Tutorials
Integrating Salesforce Files: A Guide to Internal and External Links
Olexander Orlуk
Olexander Orlуk
15 min
The complete guide to Salesforce ISV partners
24 May 2024
How-to Guides and Tutorials
The Complete Guide to Salesforce ISV Partners: Advantages and How to Become One
Yana Chekan
Yana Chekan
15 min
Everything You Need to Know about Salesforce SAP Integration
22 May 2024
How-to Guides and Tutorials
Everything You Need to Know About Salesforce SAP Integration
Eduard Chekan
Eduard Chekan
14 min
Best Practices for Building a Salesforce Knowledge Base in Lightning Experience
20 May 2024
How-to Guides and Tutorials
Best Practices for Building a Salesforce Knowledge Base in Lightning Experience
Yana Chekan
Yana Chekan
13 min
Salesforce Editions Comparison_ How to Choose the Right One_cover (1)
10 May 2024
How-to Guides and Tutorials
Salesforce Editions Comparison: How to Choose the Right One
Synebo
Synebo
13 min
How to Create a Data Extension in Marketing Cloud__cover (1)
02 May 2024
How-to Guides and Tutorials
How to Create a Data Extension in Marketing Cloud?
Synebo
Synebo
16 min
Unlocked Package vs. Unmanaged Package: Choosing the Right Fit for Your Salesforce Org
26 Apr 2024
How-to Guides and Tutorials
Unlocked Package vs. Unmanaged Package: Choosing the Right Fit for Your Salesforce Org
Synebo
Synebo
13 min
How to Set up Salesforce Experience Cloud_
24 Apr 2024
How-to Guides and Tutorials
How to Set up Salesforce Experience Cloud?
Yana Chekan
Yana Chekan
17 min
How to run a Salesforce Health Check
18 Apr 2024
How-to Guides and Tutorials
How to Run a Salesforce Health Check
Yana Chekan
Yana Chekan
16 min
A comparative analysis of managed vs unmanaged package Salesforce
15 Apr 2024
Salesforce development
A Comparative Analysis of Managed vs. Unmanaged Package Salesforce
Synebo
Synebo
13 min
How much does it cost to hire a salesforce consultant
08 Apr 2024
Salesforce development
How Much Does it Cost To Hire a Salesforce Consultant?
Andrii Kliuchka
Andrii Kliuchka
12 min
What Is the Difference Between Marketo Engage and Salesforce Marketing Cloud?
01 Apr 2024
Salesforce development
What Is the Difference Between Marketo Engage and Salesforce Marketing Cloud?
Synebo
Synebo
8 min
Salesforce B2B commerce cloud
29 Mar 2024
Salesforce development
Salesforce B2B Commerce Cloud: Benefits, Features and Implementation
Synebo
Synebo
8 min
Salesforce Sales Cloud vs Salesforce Service Cloud_ What’s The Difference
25 Mar 2024
Salesforce development
Salesforce Sales Cloud vs Salesforce Service Cloud: What’s The Difference?
Synebo
Synebo
10 min
Best ways to use chatgpt in Salesforce
20 Mar 2024
Salesforce development
Best Ways to Use ChatGPT in Salesforce
Synebo
Synebo
8 min
Why saas compnies need salesforce
19 Mar 2024
Salesforce development
Why SaaS Companies Need Salesforce
Andrii Kliuchka
Andrii Kliuchka
11 min
Salesforce Marketing Cloud account engagement vs marketing cloud
14 Mar 2024
Salesforce development
Marketing Cloud Account Engagement (Pardot) vs Marketing Cloud: What’s the Difference?
Synebo
Synebo
9min
Salesforce-Marketing-Cloud_-2-scaled
26 Feb 2024
Salesforce development
Salesforce Service Cloud Implementation – Complete Guide
Olexander Orlуk
Olexander Orlуk
14 min
Complete-Guide-scaled
14 Feb 2024
How-to Guides and Tutorials
Complete Guide to Salesforce Testing
Yana Chekan
Yana Chekan
16 min
35
17 Jan 2024
What is Salesforce Experience Cloud, and What You Get From It?
Yana Chekan
Yana Chekan
10 min
1
05 Jan 2024
How-to Guides and Tutorials
How to Send Emails via Outlook API from your Salesforce Org
Anastasia Sapihora
Anastasia Sapihora
7 min
1
27 Dec 2023
How to Improve Your Business With Salesforce Custom Development?
Yana Chekan
Yana Chekan
7min
Salesforce Marketing Cloud
26 Dec 2023
Salesforce development
Salesforce Marketing Cloud: Complete 2024 Guide
Yana Chekan
Yana Chekan
11 min
1
22 Dec 2023
21 Best Nonprofit Software Tools to Enhance Your Work
Kristina
Kristina
16 min
1
17 Dec 2023
The Anatomy of Dynamic Programming [with Codes and Memes]
Olexander Oleksiyenko
Olexander Oleksiyenko
11min
Working with salesforce files: the basics
13 Dec 2023
How-to Guides and Tutorials
How to Work With Salesforce Files: The Basics
Olexander Orlуk
Olexander Orlуk
14 min
1
11 Dec 2023
Commerce Cloud B2B vs. B2C. What Is the Difference?
Yana Chekan
Yana Chekan
5 min
1
09 Dec 2023
What is Salesforce Flow, and Why Do You Need It?
Sergii Romashov
Sergii Romashov
5 min
15 Types of Salesforce Clouds
04 Dec 2023
15 Types of Salesforce Clouds
Yana Chekan
Yana Chekan
11 min
No image available
21 Nov 2023
How-to Guides and Tutorials
How to Get Listed on Salesforce AppExchange
Yana Chekan
Yana Chekan
12 min
No image available
14 Nov 2023
Salesforce development
20 Questions to Ask Your Potential Salesforce Implementation Partner
Andrii Kliuchka
Andrii Kliuchka
12min
Cover and internal images for blog post the role of communication in outsourcing teams
07 Nov 2023
Salesforce development
Mastering Communication: Strategies for Collaborating with Salesforce Development Outsourcing Team
Pavel Vehera
Pavel Vehera
13 min
Tips for choosing the right salesforce consulting partner
31 Oct 2023
Salesforce development
How to Choose the Right Salesforce Consulting Partner?
Pavel Vehera
Pavel Vehera
11 min
1 (1)
24 Oct 2023
Salesforce development
How to Build an App for Salesforce AppExchange
Yana Chekan
Yana Chekan
14 min
36
02 Aug 2023
Salesforce Implementation: Main Challenges and Best Practices
Yana Chekan
Yana Chekan
14 min
image (1)
30 Jul 2023
All Whats and Whys of Ecommerce Automation With the Power of Salesforce
Alina
Alina
4 min
CD Transforming Salesforce Development with DevOps_cover
20 Jul 2023
CI/CD: Transforming Salesforce Development with DevOps
Olexander Oleksiyenko
Olexander Oleksiyenko
16 min
33
31 May 2023
How and Why to Use Salesforce for Nonprofits?
Alina
Alina
6min
1
27 Apr 2023
Main Benefits of Classic to Lightning Migration
Alina
Alina
4min
1
27 Apr 2023
Salesforce Sales Cloud from A to Z
Alina
Alina
6min
1
30 Mar 2023
Salesforce Licenses: How to Understand and Choose?
Alina
Alina
6min
1
04 Mar 2023
What is Salesforce Product Development Outsourcer (PDO)?
Yana Chekan
Yana Chekan
5min
1
25 Jan 2023
CMS Hub: The Guide to Managing Your Website
Kristina
Kristina
10min
phone