Close Menu
SalesforceCodex
    Facebook X (Twitter) Instagram
    Trending
    • Building a Dynamic Tree Grid in Lightning Web Component
    • 10 Salesforce Chrome Extensions to Boost Your Productivity
    • How to Build a Generic Modal Window in Lightning Web Component
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    • How to Implement Dynamic Queueable Chaining in Salesforce Apex
    • How to Implement Basic Queueable Chaining in Salesforce Apex
    • How to Suppress PMD Warnings in Salesforce Apex
    Facebook X (Twitter) Instagram
    SalesforceCodex
    Subscribe
    Saturday, July 5
    • Home
    • Architecture
    • Salesforce
      • News
      • Apex
      • Integration
      • Books Testimonial
    • Questions
    • Certification
      • How to Prepare for Salesforce Integration Architect Exam
      • Certification Coupons
    • Integration Posts
    • Downloads
    • About Us
      • Privacy Policy
    SalesforceCodex
    Home»Salesforce»Apex»Salesforce DropBox Integration to upload files

    Salesforce DropBox Integration to upload files

    Dhanik Lal SahniBy Dhanik Lal SahniMarch 19, 2022Updated:June 4, 2025No Comments4 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    Salesforce DropBox Integration to upload files
    Share
    Facebook Twitter LinkedIn Pinterest Email

    We use Salesforce files to store documents in our org. Sometimes we need to transfer these Salesforce files to some other cloud storage like AWS S3, Microsoft One Drive, Box, Dropbox, Google Drive, etc. This post will give step-by-step information on Salesforce DropBox Integration to upload files. We can also use AppExchange product for the standard approach.

    We have already done integration with AWS S3 and Microsoft One Drive. Let us see Dropbox integration for uploading files in this post.

    Read More: The Ultimate List of Salesforce Integration Resources

    Steps for DropBox integration

    1. Create Dropbox Account (Skip if already have)
    2. Create App for Developer
    3. Setup Application for File Upload
    4. Generate Access Token
    5. Create Apex Class to upload files
    6. Test Integration

    1. Create DropBox Account

    Create a free DropBox account to test integration. If you already have a DropBox account then you can skip this step.

    Click on the link https://www.dropbox.com/plans to create a free personal trial account or you can try 30 days free business account from link https://www.dropbox.com/business/try.

    Once the account is created and verified, we can proceed with the next step of app creation. You can see your account information at https://www.dropbox.com/account/general after verification.

    2. Create App for Developer

    As we need to integrate DropBox with Salesforce, we need to provide access to development. We have to create an App for developing code with DropBox.

    Open link https://www.dropbox.com/developers/apps for a developer account. You can use the same credential for this page also. Create App by clicking on Create App button. Add configuration based on your requirement or you can do similar to the attached image.

    SalesforceCodex-Dropbox Appp Creation

    Once you create an app, you will see the application configuration screen similar to the below image.

    SalesforceCodex-Dropbox Configuration

    3. Setup Application for File Upload

    Now we have to configure this application so that we can upload, create or delete files from the dropbox folder. Without giving this access we can not upload, delete files.

    Click on the permission tab to configure permission for the app. In the File and Folders section, enable files.content.write permission and Save these changes.

    SalesforceCodex-Dropbox App Permission

    4. Generate Access Token

    As we have now configured permission, now we can generate an access token that will be used in API integration. This step should always be done after setting app permission. If you already generated a token and later changed permission then we have to re-generate the token. Without regeneration, we will get authorization failure errors.

    SalesforceCodex-Dropbox App Access Token

    Click Generate button on Generated access token section in the Setting tab. Copy this access token and save it for later use. We can store the access token in custom settings, custom metadata, or Custom labels. Based on your organization’s application architecture, store access token. For demo purpose, I am using a custom label DropBoxKey.

    5. Create Apex Class to upload files

    Now we have completed the DropBox setup, Let us create an Apex class to upload files.

    For integration, we have to use file upload API (https://content.dropboxapi.com/2/files/upload) from Drop Box API. We can use Named Credential for saving this endpoint.

    SalesforceCodex-Dropbox Named Credential

    Apex Code:

    Apex Service Class for DropBox:

    This class is used to upload files using DropBox API.

    Apex Controller Class to Use DropBox service class:

    This class is used to get file details from Salesforce object record and upload that file using the above created DropboxService class. After the file is uploaded, we can store the file’s location in the FileStore__c object for later use.

    6. Test the above code

    Let us test the above code. We can call DropboxController from an apex method or we can create one invocable method which can be called from the flow action. You can refer our post Cuttly Url Shortener in Salesforce for creating invocable method (class CuttlyServiceInv).

    Code to test functionality from Developer console is

    DropboxController.uploadFileByRecord('0012v00003JMBTqAAP'); //0012v00003JMBTqAAP is Account record where file is attached

    Demo Video:

    References:

    DropBox Documentation

    Related Articles:

    1. Upload File to AWS S3
    2. Upload FIle to Microsoft One Drive.

    apex dropbox dropbox integration salesforce salesforce apex salesforce dropbox integration
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleCuttly Url Shortener in Salesforce
    Next Article Apex Trigger Code Optimization
    Dhanik Lal Sahni
    • Website
    • Facebook
    • X (Twitter)

    With over 18 years of experience in web-based application development, I specialize in Salesforce technology and its ecosystem. My journey has equipped me with expertise in a diverse range of technologies including .NET, .NET Core, MS Dynamics CRM, Azure, Oracle, and SQL Server. I am dedicated to staying at the forefront of technological advancements and continuously researching new developments in the Salesforce realm. My focus remains on leveraging technology to create innovative solutions that drive business success.

    Related Posts

    By Dhanik Lal Sahni4 Mins Read

    Building a Dynamic Tree Grid in Lightning Web Component

    June 29, 2025
    By Dhanik Lal Sahni9 Mins Read

    10 Salesforce Chrome Extensions to Boost Your Productivity

    June 1, 2025
    By Dhanik Lal Sahni4 Mins Read

    How to Build a Generic Modal Window in Lightning Web Component

    May 26, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Ranked #1 SALESFORCE DEVELOPER BLOG BY SALESFORCEBEN.COM
    Featured on Top Salesforce Developer Blog By ApexHours
    Recent Posts
    • Building a Dynamic Tree Grid in Lightning Web Component
    • 10 Salesforce Chrome Extensions to Boost Your Productivity
    • How to Build a Generic Modal Window in Lightning Web Component
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    Ranked in Top Salesforce Blog by feedspot.com
    RSS Recent Stories
    • Top 20 Salesforce Data Cloud Interview Questions & Answers for Admins June 5, 2025
    • How to Connect Excel to Salesforce to Manage Your Data and Metadata February 9, 2025
    • Difference Between With Security and Without Security in Apex January 2, 2025
    • Top Reasons to Love Salesforce Trailhead: A Comprehensive Guide December 5, 2024
    • How to Utilize Apex Properties in Salesforce November 3, 2024
    Archives
    Categories
    Tags
    apex (112) apex code best practice (8) apex rest (11) apex trigger best practices (4) architecture (22) Asynchronous apex (9) AWS (5) batch apex (9) batch processing (4) code optimization (8) custom metadata types (5) design principle (9) einstein (3) flow (15) future method (4) google (6) google api (4) integration (19) integration architecture (6) lighting (8) lightning (66) lightning-combobox (5) lightning-datatable (10) lightning component (32) Lightning web component (64) lwc (53) named credential (8) news (4) optimize apex code (4) Permission set (4) Queueable (9) rest api (23) S3 Server (4) salesforce (143) salesforce apex (48) salesforce api (4) salesforce api integration (5) salesforce bulk api (3) Salesforce Interview Question (4) salesforce news (5) salesforce question (5) solid (6) tooling api (5) Visual Studio Code (3) Winter 20 (8)

    Get our newsletter

    Want the latest from our blog straight to your inbox? Chucks us your detail and get mail when new post is published.
    * indicates required

    Facebook X (Twitter) Instagram Pinterest YouTube Tumblr LinkedIn Reddit Telegram
    © 2025 SalesforceCodex.com. Designed by Vagmine Cloud Solution.

    Type above and press Enter to search. Press Esc to cancel.

    Ad Blocker Enabled!
    Ad Blocker Enabled!
    Our website is made possible by displaying online advertisements to our visitors. Please support us by disabling your Ad Blocker.