This is courtesy of the following authors. They got it all there but I’m putting it here on my personal blog for future reference and quicker for me to copy. Read the comments in their post as they have pointed a lot of improvements to it.
MVP John Liu: https://johnliu.net/blog/2019/2/flowninja-hack-78-modifying-modified-by-and-modified-time-with-microsoft-flow
MVP Andrew Koltyakov – https://www.linkedin.com/pulse/list-items-system-update-options-sharepoint-online-andrew-koltyakov/
Use case:
Maybe for compliance stuff? One day you may have find yourself that you need to recreate a table because when you copied it the modified dates and names have changed or maybe you just want to make subtle changes to the row information without affecting the modified date/name. For whatever reason you have to this, here’s how you can do it:
So whole the process:
- Make sure that the user who run the flow has OWNER access to the SharePoint Site
- Action Card: Compose User Claim
- Action Card: Compose Form Values
- Make sure User Claims is in String
- Make sure Dates are in the proper format: ‘yyyy-MM-dd HH:mm:ss’
- Send an HTTP request to SharePoint
So some screenshots cause (i know) words are just too difficult to follow:
For Step 1
Option A
[
{
"Key": "i:0#.f|membership|@{items('Apply_to_each_2')?['CreatorEmail']}"
}
]
JavaScript[
{
"Key": "i:0#.f|membership|[email protected]"
}
]
JavaScriptCode for updated Modified on and Modified By
[
{
"FieldName": "Editor",
"FieldValue": @{string(outputs('Compose_User_Claim'))}
},
{
"FieldName": "Modified",
"FieldValue": "@{formatDateTime(utcNow(), 'yyyy-MM-dd HH:mm:ss')}"
}
]
JavaScriptCode for updated Created on and Created By
[
{
"FieldName": "Author",
"FieldValue": @{string(outputs('Compose_User_Claim'))}
},
{
"FieldName": "Created",
"FieldValue": "@{formatDateTime(utcNow(), 'yyyy-MM-dd HH:mm:ss')}"
}
]
JavaScript//FOR URI
_api/web/lists/getbytitle('List Name')/@{ID}/validateUpdateListItem
//FOR BODY
{
"formValues": @{outputs('Compose_Form_Values')},
"bNewDocumentUpdate": false
}
JavaScript