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 |
|---|---|---|---|
|
|
|
Yes |
Prefix of the file object the shortcuts should be created as. Use |
|
|
|
Yes |
Name of the file object the shortcuts should be created as. |
|
|
|
Yes |
Relationship field name between the destination file object and its parent — |
|
|
|
Yes |
Id of the parent record the shortcuts should be created under. |
|
|
|
Yes |
Prefix of the file object the source/original files belong to. |
|
|
|
Yes |
Name of the file object the source/original files belong to. |
|
|
|
No |
Id of a specific folder in the destination to put the shortcuts into. Pass an empty string for the top level. |
|
|
|
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
);