Giter Club home page Giter Club logo

sfdx-handle-file-shared-to-record-flow's Introduction

Handle File Shared to Record Flow

Declaratively handle when files are shared to records.

screenshot

Table of Contents

Overview

This project is inspired by Michelle Hansen who was seeking a way to call a flow when a file is shared to a record.

As of the Summer '19 release, ContentDocumentLink, ContentDocument, and ContentVersion objects are not supported in Process Builder to monitor for record changes. Please vote for Terence Chiu's idea.

screenshot

Not to be deterred, Michelle and I collaborated to develop an Apex trigger that could know when a file was being shared to a record and then call an autolaunched flow where the business logic could be implemented declaratively.

This project is the result of that awesome collaboration ๐Ÿ™‚

Deploy Metadata to Your Org

Before deploying to production, test in a sandbox or scratch org first. You also may need to update the Apex Test to meet your org's requirements.

Deploy Using Visual Studio Code

If you are unfamiliar with deploying metadata with Visual Studio Code, please complete Quick Start: Visual Studio Code for Salesforce Development before moving forward.

  1. Open Visual Studio Code.

  2. Clone this repository using the Command Palette.

    • Press Cmd+Shift+P on macOS or Ctrl+Shift+P on Windows to open the Command Palette.
    • Enter clone then choose the Git: Clone command.
    • Enter this repository's git url, https://github.com/douglascayers/sfdx-handle-file-shared-to-record-flow.git.
    • Select a folder on your computer where to save this repository's content.
  3. Click Open Repository from the notification that appears.

    screenshot

  4. Authorize a Salesforce org using the Command Palette.

    • Press Cmd+Shift+P on macOS or Ctrl+Shift+P on Windows to open the Command Palette.
    • Enter authorize then choose SFDX: Authorize an Org.
    • Choose the appropriate login option.
    • Enter your desired alias for this org (e.g. myorg or my-sandbox)
    • A new browser tab will open. Follow the instructions to log in and authorize the Salesforce CLI.
    • Once logged in to your org, return to Visual Studio Code.
  5. Deploy this source to your org.

    • In the Explorer side bar, right-click force-app folder then choose SFDX: Deploy Source to Org.

    screenshot

Deploy Using Salesforce CLI

If you are unfamiliar with deploying metadata with Salesforce CLI, please complete Quick Start: Salesforce DX before moving forward.

  1. Clone this repository.

    git clone https://github.com/douglascayers/sfdx-handle-file-shared-to-record-flow.git
    
  2. Change directory into the project folder.

    cd sfdx-handle-file-shared-to-record-flow
    
  3. Deploy metadata to your org, replacing YOUR_ORG_ALIAS with an alias you've already authorized with the Salesforce CLI.

    sfdx force:source:deploy --targetusername YOUR_ORG_ALIAS --sourcepath force-app
    

Getting Started

Activate and Test the Flow

  1. From Setup, activate the Handle File Shared to Record Flow flow you deployed to your org.

  2. Navigate to an account record and add a file to it, either through the Files related list or through a Chatter post.

  3. Refresh the page and note that the flow posted a Chatter message, "A file has been shared to this record."

    screenshot

Congratulations, it worked! Now it's time to customize the flow to suit your needs.

Customize the Flow

  1. From Setup, open the Handle File Shared to Record Flow flow.

  2. Delete the Post to Chatter action, then add any of your own business logic.

  3. Save the flow as a new version then activate the new version.

Go forth and be awesome!

screenshot

sfdx-handle-file-shared-to-record-flow's People

Contributors

douglascayers avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.