Skip to main content

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

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)

In your Flow:

  1. Get the target File version

    • Identify the ContentVersionId for the file you want to share.
  2. Create ContentDistribution record

    • Provide the parent record ID (recordId)
    • Provide ContentVersionId
  3. Retrieve the new distribution record

    • Query the created ContentDistribution
    • Read DistributionPublicUrl
  4. Store and use the URL

    • Save DistributionPublicUrl on your business record (Opportunity, Quote, custom object, etc.)
    • Use this value in email templates, SMS messages, or other outbound channels
tip

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 DistributionPublicUrl back to your business record

Use cases

  1. Send a proposal link in an email template and monitor proposal views
  2. Send a proposal link in SMS and monitor views/download events
  3. Send a proposal link in WhatsApp and monitor views/download events
  4. Send a proposal link in Telegram and monitor views/download events
  5. Notify internal users when a client views the shared file
  6. Revoke file access when needed

More resources