Creating Document Location Record using Flow

When we create entity record manually and upload document to that entity under Document grid, Dynamics 365 CE creates Document Location record and setup folder in Share Point for that entity, but if we are creating entity record using other option and want to attached document to entity, first we need to create Document Location record and Share Point folder for that entity. In this article we are going to discuss about creating Document Location and Share Point folder using Flow.

Let’s first note what are the prerequisite to create document location.
First you need to make sure that Share Point integration is setup in your organization. For our demo we are not using any specific entity folder like below


Now let’s first manually create contact record and upload document and note down parent site details, we can follow below steps:

1. Create a dummy contact record
2. Navigate to Related -> Documents and upload a test
3. Select file and click on Open Location to make sure it’s opening correct Share Point location


4. Navigate to Settings -> Document Management -> Share Point Document Locations and open document location record created for your test contact.
5. Click on Parent Site or Location lookup to open record and note the GUID of the record from address bar (note: We can also write a step in flow to query this but for the demo purpose we are using GUID here)

Now we have details what we require, so let’s start creating our flow.
> Navigate to Accounts and select Create Flow under flow drop down, as we want to Create contact record from Account

This will take you to Flow, if you are using flow for the first time it may ask you to setup it first. You will get screen like following, click on Continue

> Click on + sign to add new step
> Search for Common Data Service (current environment) connector and select Create New Record action from it
> Fill details like following

In above step we are creating contact using account information using dynamics contents.
> Click on + and add a variable to hold Parent Share Point Site location like below and use the GUID we captured in step 5 above.

> Add another variable to hold contact id and use formula to format and remove “-” from GUID like following.


We have used following expression to format GUID

> Again click on + sign and look for same common data service connector and select Create New Record action
> We need to create Document Location Record and need to fill properties using dynamics contents like following


Above action will create document location record in CRM but now we also need to create this folder in Share Point.
> Again Click on + sign and select Create New Folder action under Share Point and fill details like below

Above step will create folder under contact library for our new contact record using it’s GUID.

Now Save your flow and navigate to CRM under accounts and run flow to test, it should create contact record and should setup document location record for the new contact.

Annotation 2020-07-23 115215

Using above steps we can create document location record using flow, we need to keep following things in mind while creating document location record using flow and common data service current connector.

> We need to setup lookup using following way
> While using GUID for Share Point we need to remove “-” and change it to upper case

Hope it will help someone!
Keep learning, Keep sharing !!

5 thoughts on “Creating Document Location Record using Flow

  1. acegcs

    How can I get the GUID of the record? for example I am triggering the flow on create of the case record. How can I get that case GUID? I tried to use case attribute form dynamic content but getting error.

    In the variable value I put Case from the dynamic content. I didn’t understand what you did to get GUID here.

    1. Mahender Post author

      Sorry for late response but I hope you already figured it out, if not you can use primary attribute to get GUID and format it using expression.


Leave a Reply

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