Forum Discussion
Flow changes "modified by" column
Hello,
I have flow that automatically runs if a certain column is changed in a list. The value of the field gets changed from "in stock" to "used" and triggers the flow that enters the current date into another column.
Unfortunately this also changes the "modified by" column back to my name because it it "my" flow that runs and the name of the person that changed the used/instock field gets overwritten.
Is the a way the keep the name of the person that changed the used/in stock field?
- RobElliottSilver Contributor
MichaelMr No you can't change that behaviour, you would need a different column for holding the details of who had changed the used/in stock column.
Rob
Los Gallardos
Microsoft Power Automate Community Super User- MichaelMrCopper ContributorHi Rob,
thank you for your answer.
How would I do that? I am quite new to power automate.
Can I combine this with the flow that ckecks if the field value is "used" and puts the current date to the date column?
Perhaps with a parallel branch --> get item "mydiefied by" field and then?- RobElliottSilver Contributor
MichaelMr The flow for this is quite simple and you don't need parallel branches. But first you MUST make sure you have turned on item version history in the list settings as the flow needs to compare the current version with the previous version.
In this example we have a column for whether the item is in stock or used, A Date/Time column for the date it was changed from in stock to used and a single of texct column for who made that change. We are going to change the Bedar item.
The overall flow looks like this
So, the trigger is "when an item or a file is modified" and you select the site and list.
The first action is "get changes for an item or a file (properties only)". For the ID field you select ID from the dynamic content box. For the Since field you need to add the following expression into the Expression tab in the dynamic content box. This expression is what compares the current version to the previous one:
sub(int(triggerOutputs()?['body/{VersionNumber}']),1)
Next add a condition. From the dynamic content box select "Has column changed: Used", select is equal to and type in true
If that column HASN'T changed then we don't want the flow to do anything, so the red if no channel can be left empty.
But if the Used column HAS changed then in the green if yes channel add an update item action. Select ID, Title and any other required column from the dynamic content box. For the DateChanged column add an expression of utcNow() which means today. For the ChangedBy column I selected Modified By display Name, but you could select Modified By Email if you preferred.
The Bedar item was changed to Used, the flow ran and after a few seconds the ChangedDate and ChangedBy columns were updated (you might need to refresh the list to see the change).
Rob
Los Gallardos
Microsoft Power Automate Community Super User
- Donal McCarthyBrass Contributor
The SharePoint connector does not have this ability; however, the Dataverse one does.
Just point this out in case this is an option.
MichaelMr This is a known behavior if you are updating the list item from flow using Standard SharePoint connector action.
If you want to set the name of user who changed the list item in Modified By field, you can use ValidateUpdateListItem API call to update list item from flow.
Check this article for more information: modifying Modified By and Modified time with Microsoft Flow
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- RobElliottSilver Contributor
ganeshsanap that hasn't worked for over year as far as I remember from other forum posts.
Rob
Los Gallardos
Microsoft Power Automate Community Super User