Flow changes "modified by" column

Copper Contributor

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?

14 Replies

@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

Hi 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?

@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.

 

0-SP-Versions.png

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.

0-SP-List.png

 

The overall flow looks like this

 

0-Flow-Overall.png

 

 So, the trigger is "when an item or a file is modified" and you select the site and list.

 

1-Flow.png

 

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)

 1a-Flow.png

 

Next add a condition. From the dynamic content box select "Has column changed: Used", select is equal to and type in true

 

2-Flow.png

 

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.

 

3-Flow.png

 

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).

 

4-SP-Result.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

The SharePoint connector does not have this ability; however, the Dataverse one does.

Just point this out in case this is an option.

 

DonalMcCarthy_0-1643895622162.png

 

Hi Rob,

I tried your solution, thank you ver much for that.
Unfortunately the flow return an error:

"Invalid format for version input value\r\nclientRequestId: c2592141-eca8-438e-8c1e-ef7d587f5703\r\nserviceRequestId: c2592141-eca8-438e-8c1e-ef7d587f5703"

Do you know what to do?

@MichaelMr which action in the flow results is giving that error?

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@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.

@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

@RobElliott 

 

Hi Rob,

the "get changes for an item or file (properties only)" is returning the error.

 

1.png

@MichaelMr if you could show (in edit mode) both the trigger and the first action that would probably help me solve it. Thanks.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliott 

 

Hi Rob,

 

of course:

 

first step is to set the trigger,

second one is the step from your post,

third step to create a timestamp for my "date used" column,

then the conditions: "used" column hast to be "used", "date used" column has to be empty,

and the condition from your post "... has changed"

1.png2.png

@MichaelMr the error is because you have typed the "Since" expression directly in the field which is incorrect. Click in the field and over in the dynamic content box click the Expression tab. Enter the expression there and click OK. This was shown in my earlier screenshots but is shown again below. 

 

1a-Flow.png

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User

@RobElliott 

Hi Rob,

thank you. That solved the problem.

One additional question:
The flow works fine as long as the original "modified by" column is visible in the list. If I hide the "modifiedy by" colum the flow runs without error but nothing is entered in the new "ChangedBy" column.
How can I solve this?

@MichaelMr there must be some other issue, I didn't have the Modified BHy column visible in my list.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User