Tutorials
Document Management Tutorials
Renaming a folder in Sharepoint when the Record is updated
in this guide, we'll show you how to rename an account folder in sharepoint linked to an account record we'll use cloudfiles flow actions to rename sharepoint account folders automatically when the account name changes what to expect by the end of this tutorial, you can expect to have an account folder created in sharepoint for every new account rename sharepoint account folders automatically when the account name changes the gif below shows the expected output pre requisites install cloudfiles in salesforce cloudfiles is available on the salesforce appexchange and can be installed using the standard app installation process check out installation guide docid\ fv1sn qekhvsae njyp6y to know more connect your cloud storage to salesforce using cloudfiles all automations in cloudfiles are activated through salesforce flow builder, utilizing account wide authentication for external storage libraries through a service (admin) user to connect your service user, access the setup, click on the external storage of choice and log into your account for detailed steps, follow automations docid 4nyi6hnqnavp4dbjah tz or refer to the gif below for a clearer understanding add cloudfiles widget to account page add the cloudfiles widget to account page in order to view the files and folders within salesforce follow the steps below go to any account record and click “edit page” button lightning builder for this page will open insert a new tab and drag and drop the "cloudfiles" widget save and exit the builder refresh the salesforce record page the widget should now show up follow the above steps and add cloudfiles widget to the lead record page as well refer to the gif below to get a visual understanding of this step the inserted widget may show a blank screen but you don't need to worry about it move on to the next step automatic folder creation for accounts for this tutorial, we require automated folders to be created upon the creation of new account to accomplish this, we will create a record triggered flow using cloudfiles actions for a comprehensive guide on the process of creating automated folders, please refer to our tutorial at create automated folder hierarchies for managing external files from salesforce objects docid\ ynzb pjpdnjkkttmq1p t this is how the flow would look like flow account folder renaming on account name change in this section, we will create a flow to automatically rename the previously created and attached account folder into the changed name firstly, we'll configure a record triggered flow to initiate the automation process whenever an update is made to the account name then, we'll retrieve the details of the account folder finally, using cloudfiles action, we'll update the name of the folder into the new account name this is how the final flow looks like the details of the flow has been given below 1 configure a record triggered flow we will start by creating a record triggered flow on the 'account' object follow the detailed instructions below for the input parameters in the 'configure start' window, select account as the object configure trigger of the flow when a a record is updated for setting the entry conditions, follow the following steps condition requirements > select all conditions are met (and) define the condition as field > name, operator > is changed, value > true for when to run the flow for updated records, select every time a record is updated and meets the condition requirements we have selected this option since we want the flow to run everytime when the triggered record's name is changed for optimize the flow for, select actions and related records check the include a run asynchronously path checkbox the configuration looks like below the gif below provides a visual understanding of this step 2 get details of the account folder we will use get connected folder docid iq8rljf2ne8sx0 iuu apex action to retrieve the details of triggering record's corresponding account folder once you add the action, it will ask you to fill in a single parameter parentid input the salesforce record id whose connected folder is to be fetched here, input the flow triggering account record id as 'record' > 'account id' i e {!$record id} refer to the gif below to get a visual understanding of this step in case the salesforce record, whose id is input into the action has got a single folder attached to it, then get connected folder docid iq8rljf2ne8sx0 iuu will give the attached folder details as output here, by inputting the record id of the lead that triggered the flow, the action yields the details of he folder attached to the lead record we will use these details in the next step to move the lead folder to account folder 3 check account folder connection we will add a decision element to check whether there is any folder connected to the account record or not this will be simple null check over the outputs the get connected folder action used in previous step add a decision element with one configured oucome and a default outcome configure the first outcome i e in case of no folder connected to the account record enter a label for the outcome condition requirements to execute > select all conditions are met (and) define the condition as resource > outputs from get account folder > id , operator > is null, value > true when to execute outcome, select if the condition requirements are met we have selected this option since we want the flow to run everytime when the triggered record's name is changed enter a label for the default outcome this path shall execute the upcoming actions refer to the gif below to get a visual understanding of this step 4 create a cloudfiles resource variable for execution of upcoming actions, we will have to create a cloudfiles resource variable create a new flow resource resource type > variable data type > apex defined apex class > cldfs resource allow multiple values (collection) > unchecked refer to the gif below to get a visual understanding of this step 5 assign the account folder to cloudfiles resource variable in the default outcome path, we will have to assign the account folder details output by action in step 2 to the created cloudfiles resource variable of step 4 for this add an assignment element in the default outcome path map the variable values as cldfs resource > driveid > outputs from get account folder > driveid cldfs resource > id > outputs from get account folder > id cldfs resource > library > outputs from get account folder > library cldfs resource > path > outputs from get account folder > path cldfs resource > type > outputs from get account folder > type refer to the gif below to get a visual understanding of this step 6 update name of the account folder we will use set resource property docid\ tqdwxfgpgtqijeymsaa2h apex action to update the name property (property api name name ) of the account folder once you add the action, it will ask you to fill in few parameters enter a label for the set resource property docid\ tqdwxfgpgtqijeymsaa2h action set resource > cldfs resource (the variable used in the steps 4,5) set only one property as name > name == value > {!$record name} refer to the gif below to get a visual understanding of this step 7 save and activate the flow once the flow is activated, whenever an account's name is changed , this flow should automatically update the account record connected account folder name test the flows in action now that everything is setup, lets test our flows follow the steps below to see this automation in action create a new account this should create a account folder (folder name = account name) visible in the 'cloudfiles' widget on account record page now change the account name refresh the widget you will find that the sharepoint account folder's name is automatically changed to the new account name flow execution and folder creation may take some time (a few seconds to a minute) if you don't see any changes, try refreshing the cloudfiles widget a couple of times congratulations! you've successfully configured flows to rename sharepoint account folders automatically when the account name changes