Setting up the Custom Columns of SharePoint with Power Automate Flow and displaying them in Documents Grid in Dynamics 365 for Sales

, June 2, 2021 5601 Views

Many times while uploading the documents of Dynamics CRM to the SharePoint we require that the fields of Dynamics CRM be reflected in the SharePoint column and we could also see the value populated in SharePoint Column in CRM. If you have any such requirements, stay tuned, as this blog is going to cover all aspects of requirement. The only prerequisite to the blog, is that SharePoint and Dynamics 365 are integrated.

Here, let us take the scenario of an Account Wide World Importers, there is a tab named ‘Files’. Moving to that tab would automatically create a folder in SharePoint with format ‘Account Name_GUID’. There is a default Document Grid which gives the provision to upload the document directly to the SharePoint folder.

Suppose we have a custom column in SharePoint, in this case ‘Relationship Type’ and we want to populate the value of ‘Relationship Type’ column of SharePoint from the value of ‘Relationship Type’ field of Account while uploading Document from Document Grid.

We would need Power Automate Flow which would be Triggered on upload of a document in Account Document Library.

The folder name would be then extracted of the Uploaded Document and it will be compared with Document Location Entity’s relative URL to get the Document Location record associated with the folder, then regarding of that record would be Account in this case.

Fetching the required Accounts ‘Relationship Type’ Field’s Option Set text and populate it as Uploaded File’s properties column ‘Relationship Type’.

Do note, the ‘customertypecode’ is schema name of field ‘Relationship Type’ of Account.

Now whenever, the value of ‘Relationship Type’ is set in Account record, then uploading file from the Document will have the property(column) value of ‘Relationship Type’ in SharePoint set same as that of Account record.

Here, there are two documents uploaded, while uploading first document the Field ‘Relationship Type’ had value ‘Customer’, while uploading second it was ‘Reseller’, so similar values are reflected with the help of flow.

Now, when these values are updated, sometimes we just want to see the values of these columns of SharePoint in our Document Grid, the solution is simple, we just need to know that the Documents Grid is actually sub-grid of CRM Entity ‘SharePoint Document’, hence we just need to create the fields with the same name as the column in SharePoint and put them in the view, the Field should be of ‘Single Line Of Text’ Type irrespective of the Type of SharePoint Column we are trying to refer, except for the Date and Time column of SharePoint where we need to create Date and Time Field in order to refer to the SharePoint column.

In above picture, it is shown that Relationship Type field is created in SharePoint Document Entity, and this field is added as column in “All SharePoint Document” view, hence, when the Files tab is opened and the SharePoint custom column value is reflected in this field, though the SharePoint Column “Relationship Type” is of Choice type, we need to create the field with same display name in CRM SharePoint Document Entity with ‘Single Line of Text’ type.

Hope this helps


ATM Inspection PowerApp to ease ATM inspection and report generation process.

Insert data into Many-to-Many relationship in Dynamics CRM very easily & quickly, using the Drag and drop listbox.

Comply your Lead, Contact, and User entities of D365 CRM with GDPR compliance using the GDPR add-on.

Create a personal / system view in Dynamics CRM with all the fields on the form/s which you select for a particular entity using the View Creator.



INKEY is your solution partner.
Our focus is to deliver you in-time intelligent innovative solutions ("key") for the problems in hand. Maintaining a quality standard right from the inception of a project is our top most priority.

Our team of talented professionals will execute your projects with dedication and excellence. We take ownership and accountability for the effort that goes into meeting our client’s needs.

Years of experience and proven success of delivering innovative custom solutions.

More posts by

9 responses to “Setting up the Custom Columns of SharePoint with Power Automate Flow and displaying them in Documents Grid in Dynamics 365 for Sales”

  1. New Coder says:

    What values did you put for initialize the folder path and set the folder path? Could add additional screenshots?

    • Admin says:

      Hello Tasian,

      Will get back to you as soon as possible

      • Tasian says:

        Thank you, that would be great. Also, what was your value on the relationship type? (body/customertypecode)

        • Admin says:

          Hello Tasian,

          We are not setting values in the initialize folder path, we are just initializing the variable as string. For set the folder path the value would be the path where the document would be stored according to the expression “split(triggerOutputs()?[‘body/{Path}’],’/’)” for this variable. Relationship type would be set according to the value selected in the dropdown.

          The values will be set when the flow runs and will be based on which table the flow is being run on i.e. account, contact etc. and the values selected in the optionset for relationship type.

          Let us know if you need any more information.

          • Tasian says:

            When a file is created (properties only)

            Are you putting your relationship type values on the form? OR

            Are you going into the files location and adding the relationship type value ?

            The way my form is set up is: I have tabs with the field on each tab and the flow isn’t triggering at all.

            Here is my form: https://community.dynamics.com/365/f/dynamics-365-general-forum/436131/power-automate—when-a-file-is-created-properties-only-not-triggering-when-document-is-uploaded

          • Admin says:

            We have put the relationship type value on the form and that is where we are setting its value.
            As for why your flow is not being triggered, I am not completely certain but I would suggest you check the connections. The flow may be pointing to a different environment then the one that you are working on. For example, the flow may be connected to sandbox but you may be trying to triggering it from production.

          • Tasian says:

            List Document Locations > Is that List Rows using Microsoft Dataverse” finding the “Document Locations” Entity?

            Get Account is that “Get row by ID? by finding the “Account Entity”

            locationtype eq 0 is throwing an error for me.

  2. Faith says:

    Thank you for such a good blog.

    I wanted to ask what do you do when the custom column is a choice column with more than 2 values?

    • Admin says:

      Hello Faith,

      Thank you for your reply.

      Do you mean that you want to store the multi values in a choice column?

      In that case, we can create the multiselect optionset field at Dynamics 365 and multiselect choice column at SharePoint. Then update the value from Dynamics 365 to SharePoint column.

Leave a Reply

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

The maximum upload file size: 2 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Drop file here

Would you like to digitize your business and put it on the cloud?
Do you need clear, concise reports for your organization?