We recently had a requirement to create the SharePoint folder automatically on the Account records creation, instead of having the users click on the Documents tab to create it.
We could write a Power Automate flow to achieve this.
Here we have enabled the Share Point server-based integration. Also, the SharePoint Site and the main or parent folder for the Account are already created/configured.
Below is the corresponding Document location record for the parent Account folder.
- So basically, we will create a new folder inside the Account folder in the SharePoint site configured in CRM.
- Then create a new SharePoint Document Location record specifying the Account document location as a parent.
- And then Associate / Relate the new account record created with this new document location record.
Below is how our Flow will look like –
- Triggers on Account record creation.
2. Create a new folder inside Account Folder, here for the name of the folder we are using the format “AccountName_AccountNumber“
3. Create a new Document Location record, associating the Account document location with the parent location record. Here we are specifying the same folder name in the relative URL.
We can also fetch the GUID of the Account document location and/or use a variable to store the GUID.
4. Lastly, we are associating these 2 new records.
Below is our newly created account record.
Below we can see our flow ran successfully.
We can see the new folder created and associated.
Here if we click the Documents tab immediately after creating the account record, before our flow runs, we might have the OOB folder also getting created along with our custom folder (flow being asynchronous). If our custom folder is already created and associated before the user clicks on the documents tab, then CRM will not be creating a new folder.
Hope it helps..