Automate Shareable Links for Salesforce Files
Automatically generate public share links for Salesforce Files with Flow by creating a ContentDistribution record and reading its DistributionPublicUrl.
Introduction to Salesforce file sharing
Salesforce Files provide a secure way to store and share documents.
For customer-facing communication, shareable links are often more practical than sending large attachments.
With a shareable link, you can:
- Send the same file through multiple channels (email, SMS, messaging apps)
- Track engagement (views/downloads, where available)
- Revoke access when needed
Understanding the need for shareable links
Instead of manually creating links for every file, you can automate link creation in Flow.
This is useful when your process already generates documents (for example, proposals or quotes) and you want to immediately:
- Save the share link on a Salesforce record
- Send that link to the customer
- Monitor link activity
Configuring permissions for file sharing
Before building the flow, verify file distribution is enabled in your Salesforce org.
Checklist:
- Content Distribution is enabled
- Users running the Flow can access Files and create ContentDistribution records
- Target object has a field to store the generated public URL (optional but recommended)
Generating shareable link automatically
In your Flow:
-
Get the target File version
- Identify the
ContentVersionIdfor the file you want to share.
- Identify the
-
Create
ContentDistributionrecord- Provide the parent record ID (
recordId) - Provide
ContentVersionId
- Provide the parent record ID (
-
Retrieve the new distribution record
- Query the created
ContentDistribution - Read
DistributionPublicUrl
- Query the created
-
Store and use the URL
- Save
DistributionPublicUrlon your business record (Opportunity, Quote, custom object, etc.) - Use this value in email templates, SMS messages, or other outbound channels
- Save
Keep the generated URL in a dedicated text field so it can be reused across automations and reporting.
Flow pattern (quick reference)
- Input:
recordId,ContentVersionId - Create Records:
ContentDistribution - Get Records: fetch created distribution row
- Update Records: write
DistributionPublicUrlback to your business record
Use cases
- Send a proposal link in an email template and monitor proposal views
- Send a proposal link in SMS and monitor views/download events
- Send a proposal link in WhatsApp and monitor views/download events
- Send a proposal link in Telegram and monitor views/download events
- Notify internal users when a client views the shared file
- Revoke file access when needed