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)
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.
> 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.
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 !!