31 Jan’19

D365 GeneralCreate Folder Structure in SharePoint using MS Flows


In this blog we will see how we can create folder structure in SharePoint for Leads when the record is created in CRM using MS Flows

Pre Requisites:

SharePoint Integration must be enabled for the required entities


Step 1: Here in our Flows we have used “Create of a record(Leads)” as trigger condition.

Trigger Condition Lead creation

Step 2: Then we create the folder structure in SharePoint using the “Create File” action
Here we will create a text file which can be deleted later if not required.
Folder Path: /Lead/Topic_toUpper(replace(triggerBody()?[‘leadid’],’-‘,”))
Here “Topic” is Dynamics value and for the record ID copy paste the expression written above in the Expressions tab and add it at the end of the Folder Path.

Create main folder

After we have created the folder structure if the file is not required we can delete the text file by adding the delete step as shown below
Delete File

Step 3: We will also store the Folder ID in a variable “FolderId” to use in the later steps
FolderID variable

Step 4: Now we will create the same folder structure in CRM (Document Location)
Create Document Location 1

Document Location 2

Here for the parent site or Location we have we have added the GUID of the Parent Document Location site for Leads.
We can get this from the URL of the Parent Document Location record from Advanced Find (Document Location Entity)
Document Location Default Site

Lead document location record URL: https://org.crm8.dynamics.com/main.aspx?etc=9508&extraqs=%3f_gridType%3d9508%26etc%3d9508%26id%3d%257b1957C431-5F15-E911-A96F-000D3AF29269%257d%26rskey%3d%257bF5B008AC-07D9-4554-8509-2C05767BFF51%257d&histKey=17520860&newWindow=true&pagetype=entityrecord&rskey=%7bF5B008AC-07D9-4554-8509-2C05767BFF51%7d#371473802

Step 5:  Similarly we can also create sub folders within the main folder as per the requirements

Hope this Helped!

Written by

Clinton D'Mello

Software Engineer

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Expenses in PSA for Fixed Bid and T&M contracts

    23 August’ 2019

    Problem Definition: One of my clients decided to use Expense module in PSA and to his surprise he could see the amount v...

    Read more
  • Setup Dockers

    23 August’ 2019

    Docker is an independent container platform that enables organizations to seamlessly build, share and run any applicatio...

    Read more
  • Qualify Lead in D365 CE: Select which entity records should be created

    20 August’ 2019

    Wave 2019 Updates brought some really sought-after features. Another one which I would like to bring up is the Lead Qual...

    Read more
  • Early Opt-in for October 2019 Wave 2 Updates

    20 August’ 2019

    August 2, 2019 was when the Wave 2 Updates were to be out. And here we are! By now, you should have gotten the option to...

    Read more
  • Setting Unified Interface App Icons

    20 August’ 2019

    Default App Icons for typical D365 environment look like these.But here’s what you can do to change these to put...

    Read more
  • We respect your privacy.
  • This field is for validation purposes and should be left unchanged.