Power Community

Power Community

System Updates in SharePoint from Power Automate using the ValidateUpdateListItem endpoint

Today I wanted to update Documents/Items without triggering other flows. The ValidateUpdateListItem endpoint in the REST API made this System Update possible.

System Updates vs Updates

Normally when an item is updated in SharePoint, flows that are triggering on the list my trigger. Sometimes however you might want to update the triggering list item with for example a new status value on the status field. If you want to do this update and you don’t want a flow to trigger you can do a System Update. A silent update may be a better term for this, however in the SharePoint world this has been called System Update for quite a while.

So how can we do a system update from a flow in Power Automate.

First I’m going to have a look at the REST API, ValidateUpdateListItem endpoint

The ValidateUpdateListItem endpoint

I’ve implemented my system update as part of a child flow so that I can call this system update from other flows, without having to repeat the logic of the system update.

Using the Send and HTTP request to SharePoint action we can construct the following action.

System Update from a Power Automate  flow

I’m taking the SiteUrl, the Item ID and the Update details as input for my System Update action.

I’m going to have a look at the formValues in a bit. First I’m going to have a look at the bNewDocumentUpdate property.

The bNewDocumentUpdate we can set to true or to false. When this property is set to True, no new versions are created. Well …

This pain that I bumped into made me think for a while that the System Update didn’t work anymore. And I’m not the only one. On GitHub I found the same issue:

https://github.com/SharePoint/sp-dev-docs/issues/7424

Within the System Update we have to include the Editor field. Without the Editor field being included a new version is added to the updated item.

Update Details

For an update to be successful we could set the formValues as shown below.

{"formValues":   [

{ "FieldName": "LastUpdatedFromFlow",
"FieldValue": "2024-01-05 12:30.44"},
{ "FieldName":"Subject",
"FieldValue": "Document5.docx"},
{ "FieldName": "DocumentType",
"FieldValue" :"Letter" },
{ "FieldName": "Editor",
"FieldValue" : "[{'Key':'i:0#.f|membership|pieter.veenstra@mytenant.onmicrosoft.com'}]"
}
] ,
"bNewDocumentUpdate":true
}

Notice that formValues is an array of objects with the following two properties:

  • FieldName
  • FieldValue

In the above example Subject is a simple text field, LastUpdatedFromFlow is a date field and DocumentType is a choice field. Editor is the out of the box modified by people field.

The way these system updates are configured are actually really good as the updates of most types are simply done by supplying the value that a user would see in the SharePoint UI.

The Editor

As mentioned the editor field is very important. And as mention in the above GitHub issue, the Editor needs to be set tot he Claim of a user ( with that “i:0#.f|membership|” stuff in front of the account) and otherwise it will not work.

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

New in Spring 2024: Map Routing and Visualization for Power Pages Portals

“Morning Jo, what is the Tea this morning?”, Josh asked as he rushed into the office. “Well, Maplytics is...

More Articles Like This

- Advertisement -spot_img