cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dagspot
Frequent Visitor

Flow- List to List and delete

Hello. I really don’t know what I am doing but have tried hard!

I have an existing MS List and have created an archive version with same columns.

I would like a process where if a single row in the main list is manually deleted, that row/item of data gets auto transferred to a new row in the Archive list.

Some of the column data is in drop down option mode.   I played around with templates but got nowhere. Eventually I got something to work but everything (all 300 rows/items) transferred! 

Then only entry appeared in main/first column in Archive list which looked like an id number or row count. 

I may have blindly adjusted too many settings now.  Any guidance or pointers to templates would be appreciated. 

10 REPLIES 10
eric-cheng
Solution Sage
Solution Sage

Hi @dagspot ,

 

Can you post a screenshot of the flow you have so far.

 

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

Connect on LinkedIn

@eric-cheng 

Thank you Eric !  Below is what I have in 3 sections.  

The master List is called "Active second line database" and on deletion of a row item there- should be copied to the archive second list "stopped second line database"

Part 1Part 1

 

Part 2Part 2

 

Part 3Part 3

 

dagspot
Frequent Visitor

any suggestions for a flow to make this work? 

eric-cheng
Solution Sage
Solution Sage

Hi @dagspot ,

 

Unless I am missing something with the flow, when you delete a item and the flow triggers, the item would have already been deleted and moved to the recycle bin.  As such, you won't be able to use Get Item.  FYI, the fields you will get are below from the trigger body.

 

{
"ID",
"Name""",
"FileNameWithExtension""",
"DeletedByUserName""",
"TimeDeleted""",
"IsFolder"
}
 
The workaround for this is to use the SharePoint API to query recycle bin here OR to have a change in process of how users delete the item e.g. soft delete which set a deleted status and the flow will do the delete or create a sharepoint (for an item) trigger.
 
--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

Connect on LinkedIn
dagspot
Frequent Visitor

@eric-cheng 

Ideally that kind of sounds like what I need but looks to advanced for me!

Perhaps it might work if order was different eg on any edit/update, copy item to second list and *then* automated function to delete original?  (rather than take from recycle bin)

@dagspot I would go with @eric-cheng's soft delete solution which is to have a "Delete" column in your list which is either empty or has Delete in it. Then run a flow with the trigger of "when an item or a file is modified" then add the "get changes for an item or a file (properties only)" action. For this to work you MUST have list item versioning switched on in your list settings because we are comparing the current version of the item with the previous version. In the Since field you would compare the current and previous versions with an expression as follows:

 

sub(int(triggerOutputs()?['body/{VersionNumber}']),1)
 

The next action would be a condition with Has Column Changed: Delete is equal to true and then a new row of Deleted is equal to Delete.

 

In the green if yes channel you'd then add the create item action for the archive then the delete action, and there would be nothng in the red if no channel.

 

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

This is all great @RobElliott @eric-cheng 

I will certainly now try this solution and see if I am understanding correctly. 

So in theory by selecting delete (perhaps from a drop down list?) in a new column- this would be the modify trigger to move to the other list.

Would I then perhaps have a scheduled flow to remove all those marked Delete at a later date to keep the main list tidy?

Will look into the Versioning setting.  Thank you again.  

dagspot
Frequent Visitor

Ok here is the flow I created with a new column called Archive with a drop down option just of Delete

Still nothing happening / transferring to new Stopped Second Line Database list if I modify column to Delete. Where am I going wrong ?

@RobElliott

@eric-cheng 

 

 

Pt1Pt1

 

Pt2Pt2

 

Pt3Pt3

 

Pt4Pt4

 

@dagspot some immediate things I can see:

1) In the since field of the get changes action you don't just type in the expression I gave you; you add it to the expression tab in the dynamic content box;
2-Flow.png

 

2) in your condition you have put is equal to True, it should be is equal to true

 

3) Have you turned on list item versioning? No of it will work unless you do.

 

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

eric-cheng
Solution Sage
Solution Sage

Hi @dagspot ,

 

In addition to @RobElliott 's suggestion, the below flow could also work for what you are trying to do.

 

ericcheng_0-1634434896127.png

 

You can also add a trigger condition so that it will only trigger the flow when Archive column is set to Delete and not for other changes.

 

ericcheng_1-1634435075613.png

 

@equals(triggerBody()?['Archive'], 'Delete')

 

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

Connect on LinkedIn

 

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,194)