S-Drive 3.6 Documentation

createShortcuts

Creates shortcuts to existing files under a different parent record (and optionally into a specific folder there), without duplicating the underlying file content.

How to call this method

global static void createShortcuts(
    String destinationObjectFilePrefix,
    String destinationObjectFileName,
    String destinationRelationshipName,
    String destinationObjectId,
    String sourceObjectFilePrefix,
    String sourceObjectFileName,
    String selectedFolder,
    List<String> fileIds
)

Parameters

Parameter

Type

Required

Description

destinationObjectFilePrefix

String

Yes

Prefix of the file object the shortcuts should be created as. Use cg__ for S-Drive's built-in file objects.

destinationObjectFileName

String

Yes

Name of the file object the shortcuts should be created as.

destinationRelationshipName

String

Yes

Relationship field name between the destination file object and its parent — Parent__r for custom objects, or the Master-Detail/Lookup relationship name for S-Drive's built-in objects.

destinationObjectId

String

Yes

Id of the parent record the shortcuts should be created under.

sourceObjectFilePrefix

String

Yes

Prefix of the file object the source/original files belong to.

sourceObjectFileName

String

Yes

Name of the file object the source/original files belong to.

selectedFolder

String

No

Id of a specific folder in the destination to put the shortcuts into. Pass an empty string for the top level.

fileIds

List<String>

Yes

Ids of the source/original files to create shortcuts of.

Return value

Doesn't return anything.

Example

Creating a shortcut of an existing Case File on an Account--the resulting shortcut is an Account File.

String accountId;
List<String> caseFileIds;

cg.SDriveTools.createShortcuts(
    'cg__', 'AccountFile__c', 'Account__r',
    accountId,
    'cg__', 'CaseFile__c',
    '', // top level, no specific folder
    caseFileIds
);