SharePoint Document Upload in Dynamics 365/CDS with Custom Field (Part 3 of 3)

This is the third post in a series of File field as input and SharePoint as storage. You can check out the other posts via these links (Part 1, Part 2)

Customising the document upload dialog box for the purpose of adding an additional field to capture the metadata of the uploaded document is a common ask in the community forums. Now in one of my previous blog posts about How to Add Metadata to SharePoint Document Subgrid in Dynamics 365, I also got a question in the comment section.

Is there a way to add custom column (field) on the Upload Document popup on Dynamics 365?
Also, on the custom column (field) on the Edit Document Properties popup on Dymanics 365?

That was a good question for that blog post since the solution was only about showing the custom metadata in the SharePoint Document Subgrid and there is no easy way to allow the user to enter the custom metadata during the file upload.


As of now, there is no supported way to customise the document upload dialog box. The users will need to  'Open Location' and edit the Properties of the document in SharePoint after the document is uploaded. The closest solution I can think of is implementing the document upload PCF control like this with the input for additional metadata.

When I received that question, I was writing a two-part series of File field as input and SharePoint as storage blog posts. Then, I tried to solve that requirement with low-code solution using Power Automate and decided to extend the series with this third post. This solution is just the enhancement of the solution in the previous post "Move Attachment from File Field of CDS to SharePoint in Power Automate". Before continuing, I recommend you to check out the first post to understand the original solution.


For this sample solution, I added a new text field "Identifying Document Remarks (lzw_identitydocumentremarks)" to capture the remarks for the file uploaded to SharePoint via the File Control.

After that, two additional steps were added to the flow in the previous post to populate the custom column of the SharePoint library with the value from the new textbox. The steps were added after "Create file" step and the first step is just to initialise the JSON object of the SharePoint properties. If there are more than one columns, add more properties into that JSON object. This step is not required if the Site Address is static and not populated with the custom value.

The second step is updating the properties of the created file using Update file properties action of the SharePoint connector. Just like the other SharePoint action steps, the Site Address is populated with the variable and if you cannot enter the custom value for the Site Address, disable the Power Automate Experimental Features. The library name is 'contact' and the Id is the ItemId output from the Create file action step. The Item property is normally rendered in multiple input boxes for the Title and other custom columns (as in the screenshot below) if the Site Address is selected from the drop-down list and the variable is not used. In that case, each metadata can be populated into the relevant input boxes. Otherwise, all properties need to be initialised as a JSON object and populated into the Item property as in the screenshot above.


Summary

Capturing custom column (field) metadata for the SharePoint document file uploaded via model-driven app interface is possible with the File Field of CDS and the Common Data Service (current environment) connector and SharePoint connector in Power Automate. The solution can be extended further by storing the Unique Id of SharePoint document and library name in the custom child entity to allow updating the document properties custom column (field).


You can download the above sample flow from my GitHub repository via this link.

Comments

Popular posts