Flow Actions
Doc Management Flow Actions
Create Salesforce Files (Batch)
introduction the cloudfiles create salesforce files (batch) flow action allows you to copy multiple files from external storage into salesforce as salesforce files ( content document s ) in a single action this action functions similarly to the create salesforce file docid\ fnqyk7y504tsivsv5c533 flow action, which handles a single file, but the batch version processes multiple files at once by using a collection of metadata details as input, the action identifies and retrieves external files and creates their corresponding salesforce files once executed, the action makes all the salesforce files accessible and manageable within the salesforce environment, streamlining bulk file operations and automations below is a visual representation of the action, with detailed descriptions of its input and output parameters provided in the subsequent sections what this action does the cloudfiles create salesforce files (batch) flow action enables copying multiple external storage files (identified by their metadata details) into salesforce as salesforce files ( content document ) in one action once all files are successfully created in salesforce, a content version created batch docid 6fmkm8fxqj6y9eftjuwyj is published this action can be paired with other flow actions or elements to streamline processes such as bringing multiple external storage files into salesforce for enhanced accessibility enabling bulk file operations within salesforce based automations (e g , batch email workflows) integrating with external applications designed to work with salesforce files example use case suppose you've integrated external storage like sharepoint, where multiple customer related files (e g , proposals, contracts) are stored in dedicated folders you want to automate the process of importing these files into salesforce and emailing them to all related contacts file selection in a screen flow, display a list of file choices (e g , file names mapped to file ids) from the customer's folder the user selects multiple files input to action pass the selected files' metadata as a collection (as a collection of cldfs resource ) into the create salesforce files (batch) action trigger cloudfiles event flow once all the files are successfully created, the published content version created batch docid 6fmkm8fxqj6y9eftjuwyj can be used to link the files to the corresponding salesforce account using content document links email automation in a subsequent flow, fetch the created salesforce files and email them as attachments to the related contacts this action simplifies the process of importing multiple files into salesforce while leveraging its robust automation capabilities the batch processing ensures efficiency by handling multiple files in one go, and the event driven architecture supports further automation seamlessly input parameters let us discuss each of the input parameters in detail in the sections below files the files parameter accepts a collection of file resources (i e , a collection of cldfs resource ) that contain metadata details for all the files to be copied into salesforce as salesforce files steps to configure 'files' parameter use case example you want to import all files from an account folder in connected sharepoint into salesforce here’s how to configure the files parameter for this scenario step 1 retrieve all files in the folder use the get folder contents action to fetch all files within the folder the action returns a collection of cldfs resource items, each containing the required fields drive id identifies the external storage drive id the unique file id in the external storage system library specifies the storage type (e g , sharepoint) now, you have a collection of file resources representing all files in the folder step 2 pass the files collection to the action assign this collection of cldfs resource to the files parameter of the create salesforce files (batch) action this allows the action to process each file in the collection, copying them into salesforce example snippet in a flow use the get folder contents action and store the output as a collection variable (e g , filescollection) pass filescollection into the files parameter of the create salesforce files (batch) action salesforce record id the salesforce record id parameter is used to identify and manage the origin of a created salesforce files when a content version created batch docid 6fmkm8fxqj6y9eftjuwyj is published purpose event identification helps distinguish the source of the event in scenarios where multiple flows use the same action for different objects or use cases content document linking enables creating a content document links to associate the salesforce files with a specific record key features flexible input you can input any text string, not just a record id event output whatever you input here will be available in the corresponding event details as parent id how it works input the record id of the relevant record into this parameter when the event is triggered, the record id is included in the event details in the platform event mode flow setup docid\ hbil pqlgbixyg81yse9g event triggered flow, retrieve the record id from the event details to filter and process further automations, such as linking the file to the record for example, if you want the created salesforce files to be associated with an account record, input the account's record id into this parameter in the event triggered flow fetch the record id from the event details use the content document link action to associate the created file with the account this parameter ensures traceability and flexibility in handling files across different flows and use cases you can use this parameter not just to input a record id but literally any text string whatever, you input into the action shall be output in the corresponding content version created docid\ im asjotnofrrs9gvxvt5 if you need to create salesforce files linked to a contact record but in two separate scenarios scenario 1 input "scenario1 contactrecordid" as the parameter scenario 2 input "scenario2 contactrecordid" as the parameter in the event triggered flow fetch the parameter value from the event details use it to identify the contact record id and differentiate between the two scenarios this approach allows you to retrieve the contact record id for further automation differentiate between events to handle specific actions based on the scenario output parameters the cloudfiles create salesforce files (batch) apex action does not return anything as an output in the flow it is used but for every scuccesful flow action execution or once all the salesforce files created a content version created batch docid 6fmkm8fxqj6y9eftjuwyj event is published this event signals the completion of creationsalesforce files/ contentdocuments creation and can be used to trigger platform event flows to perform post creation actions if the action fails due to some reason, an error event event will be triggered and this event can be used in a decision element to diagnose and handle the error