Row Update After SharePoint File Upload

Yawer IqbalDyn365CE3 years ago11 Views

A common requirement is to update the record row in Dataverse table after a file has been uploaded to SharePoint. This small post documents the steps and expressions for it. For demonstration, I m using “Account” table and have created “URL” a custom column in it. After file uploads, I will update the row and safe URL in this field.

Summary

This post do not cover the steps required to configure SharePoint for document storage with Model-Driven App. Follow this link for integration details). Cloud flow triggers when a file is uploaded from Model Driven App and created in the SharePoint document library.

  1. Create a cloud flow and add “When a file is created (properties only)” trigger. Configure the following properties:
    • Site Address
    • Library Name

2. To upload Dataverse row, we need GUID. Unfortunately it is not available as plain text, though we can drive it from trigger’s Folder path property.

Its value will be similar to account/test_67B9406FCBB7EB118236000D3A6A4A8A/

we need to extract GUID from it. Expression which I have used uses three functions and here is complete expression:

replace(last(split(triggerOutputs()?[‘body/{Path}’],’_’)),’/’,”)

Need explanation ?

split(triggerOutputs()?[‘body/{Path}’],’_’) will divide account/test_67B9406FCBB7EB118236000D3A6A4A8A/ into two from ‘_’. Wrapping it under last function will return 67B9406FCBB7EB118236000D3A6A4A8A/ only. I have used replace function to remove last ‘/’.

3. In step 2, we have got the GUID but it is not in format that we can used to fetch or update row. Instead of

67B9406FCBB7EB118236000D3A6A4A8A

we need it in 67B9406F-CBB7-EB11-8236-000D3A6A4A8A format.

Here is expression that will do this:

concat(substring(variables(‘StringGUID’),0,8),’-‘,substring(variables(‘StringGUID’),8,4),’-‘,substring(variables(‘StringGUID’),12,4),’-‘,substring(variables(‘StringGUID’),16,4),’-‘,substring(variables(‘StringGUID’),20,12),”)

In this post I have explain this expression.

4. Last steps is to use FormatedGUID and update record. For demo I have created a custom field “URL” and populating document URL in it.

Lets test the Flow after turning it on.

CodeProject

Let’s Connect

 twIcon lnIcon fbicon

Original Post https://yaweriqbal.com/2021/05/30/dataverse-row-update-after-sharepoint-file-upload/

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
March 2025
MTWTFSS
      1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31       
« Feb   Apr »
Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...