Create Shortcuts in Flow

A common use case is to create a shortcut on another record when a file is uploaded. For example, when an Opportunity File is uploaded, create a shortcut to the file on the Opportunity’s Account.

When creating Shortcuts in a Flow, you must use a collection variable to store the source file id, even if you’re just creating one shortcut. Use the Apex Action “S-Drive Create Shortcuts Action” to create the folders from the list of folder names.

Sample Flow

Here are the steps for a sample flow to create a shortcut on the parent account of an opportunity whenever an opportunity file is uploaded. Some knowledge of Flows is assumed. Refer to Salesforce documentation if you need help with Flows.

  1. Create a new record-triggered flow that triggers when a file is uploaded to an Opportunity. The triggering object is Opportunity File. Because of the way S-Drive works when files are uploaded, you must specify the following entry conditions:

    1. Field = cg__WIP__c

    2. Operator = Is Changed

    3. Value = False

  2. Use an Assignment element to list the names of your source files (the files you want to create shortcuts for). Even if you only have one file, you must put it in an Assignment element using a collection variable.

    1. Select the Assignment element

    2. After giving it a name (ex: Store source file ids), under Variable, click New Resource. This will be the variable where you list your folders

    3. In the New Resource popup:

      1. Resource Type=variable

      2. Give it an API Name (ex: SourceFiles)

      3. Data Type=Text

      4. Check the box for Allow multiple values (collection)

      5. Click Done

    4. Back on the New Assignment window, add the file ids of the files you want to shortcut

      1. Variable = SourceFiles (the api name of the variable you just created)

      2. Operator = Add

      3. Value = go to the record that triggered the flow and traverse to the id field ({!$Record.Id})

      4. Click Done

  3. In the Flow canvas, add an Action element

    1. Filter by Type

    2. click Apex Action

    3. Type S-Drive in the search box and choose S-Drive Create Shortcuts Action



  4. In the New action window:

    1. Give it a Label and API Name (ex: Create Shortcut on Account)

    2. Set Input Values:

      1. Destination File Object Name: cg__AccountFile__c

      2. Source File Ids: select SourceFiles (created above) under Collection Variables

      3. Source File Object Name: cg__OpportunityFile__c

      4. Parent Record Id: traverse from the record that triggered the Flow, to the Opportunity to the Account id ({!$Record.cg__Opportunity__r.Account.Id})

         

    3. Click Done

  5. Save and activate the flow

Input Values for S-Drive Create Shortcut Action

Destination File Object Name: API name of the object the shortcut will be (ex: cg__AccountFile__c) This should be typed in (it won’t be available in the search)

Source File Ids: The collection variable where you stored the file ids of the files to be shortcutted

Source File Object Name: The API name of the object of the source files (ex: cg__OpportunityFile__c)

Parent Folder Id: If included, this can be used to put the shortcut inside a folder.

Parent Record Id: Id of the record where you’re creating the shortcut, such as Account record id in the example here. This is not needed for S-Drive Tab (S3Object)

Relationship Name: This is the lookup field to the parent, such as cg__Account__c or Parent__c. It is not needed for S-Drive Tab (S3Object)