Flow Actions
Doc Management Flow Actions
Copy Salesforce Files
introduction the copy salesforce files flow action can be used in process automations where you have a requirement to copy native salesforce files to a desired location in external storage the image below gives an overview of the input parameters and what this action looks like detailed description of these input parameters and it’s outputs are provided in the following sections what this action does the copy salesforce files flow action copies salesforce files (identified by their content document ids) to an external storage location (identified by its metadata) for each file copied, a salesforce file copied https //help cloudfiles io/salesforce/salesforce file copied event event is triggered on successful file copy this action can be combined with other flow actions or elements to automate processes, such as moving files attached to object records into their connected external storage folders for instance, the flow snippet below demonstrates a use case where the copy salesforce files action copies files attached to account records (triggered by the salesforce file attached https //help cloudfiles io/salesforce/salesforce file attached event event) into their respective account folder (details provided by the get connected folder https //help cloudfiles io/salesforce/get connected folder flow action action) once each file is copied, a salesforce file copied https //help cloudfiles io/salesforce/salesforce file copied event event is published, providing the copied file details and enabling the file to be deleted from salesforce after a successful copy refer to the tutorial https //help cloudfiles io/salesforce/automatically moving files from salesforce storage to external storage to understand the use case in detail the image below illustrates how this automation would look input parameters let us discuss each of the input parameters in detail in the sections below content document ids input the text collection of content document ids of salesforce files which are to be copied a content document represents a document that has been uploaded to a library in salesforce crm content or salesforce files the content document id could be used to uniquely identify a salesforce file one way of getting content documents ids is by using get records https //help salesforce com/s/articleview?id=sf flow ref elements data get htm\&language=en us\&type=5 flow action with content document link as its object and by passing record id of the desired record as linkedentityid refer to the article https //developer salesforce com/docs/atlas en us object reference meta/object reference/sforce api objects contentdocument htm to know more about content document ids this action cannot be used to copy “attachments” (salesforce files old format) destination resource parameters these parameters are needed to specify the copy location you can get these parameters by viewing metadata details for a folder in the “content library” tab of cloudfiles app in salesforce or can be fetched through other flow actions or elements like “get connected folder” library input the destination library possible values are sharepoint , google , azure , onedrive , dropbox , box , s3 , sftp or cloudfiles drive id this is important for google drive & sharepoint libraries only the drive id is a unique identifier for a storage location in both sharepoint and google drive in sharepoint, it represents a document library within a site, while in google drive, it identifies a user's drive or shared drive folder id this is the folder id of the destination folder into which the files are to be copied if you wish to copy directly into a drive instead of a folder, you can skip this parameter salesforce record id (optional) input the object record id to which the salesforce files are attached you can use the salesforce record id to not just input a record id but literally any text string whatever, you input into the action shall be output in the corresponding salesforce file copied docid\ m9v6ikaxwsmxifd5e7zwy event if you need to differentiate the event based on the type of the object and also in between two separate scenarios scenario 1 input "scenario1identifierterm recordid" as the parameter scenario 2 input "scenario2identifierterm recordid" as the parameter in the event triggered flow, fetch the input parameter value from the event details, output as parent id this approach allows you to retrieve the record id for further automation and d ifferentiate between events to handle specific actions based on the scenario output parameters the apex action does not return anything as an output in the flow it is used but for every file copied, a salesforce file copied https //help cloudfiles io/salesforce/salesforce file copied event event is published this event signals the completion of the file copy and can be used to trigger platform event flows to perform post copy actions such as deletion of files or updation of metadata if the action fails due to some reason, an error event event will be triggered and this event can be used in decision element to diagnose and handle the error if a file is already present at the destination with the same name of the file which is being copied, the handling of this conflict behaviour will be according to the preset configuration in cloudfiles app as shown in image below see it in action the gif below demonstrates the example use case we discussed in prior section i e moving files attached to object records into their connected external storage folders refer to the tutorial https //help cloudfiles io/salesforce/automatically moving files from salesforce storage to external storage to implement and understand the whole flow for this use case