cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PBala
Helper II
Helper II

Based on a condition, copy list item with attachments to another list

Hi,

I am trying to convert a SharePoint 2010 workflow to Power automate.

 

When an item is modified, based on a condition, I would like to copy an item with multiple attachments to another list.

 

In Power Automate, how can I get the specific item which meets the condition to move to another list along with attachments?

 

Thanks for the help, I am lost on how to get a specific item and copy over with attachments.

 

PBala_0-1603380072875.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
PrasadAthalye
Community Champion
Community Champion

instead of leaving it empty can you click expression and type null? Also I recommend you to add this as a trigger condition it self so that Flow wont run on every update...

 

PrasadAthalye_0-1621629520755.png

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

View solution in original post

11 REPLIES 11
PrasadAthalye
Community Champion
Community Champion

@PBala Which item are you looking to move? The one on which you are creating a trigger on? Can you please provide more details? 

 

You can use Create Item to create new item in destination list and then use Add Attachment to add attachment to that item. you can get attachment content by using Get Attachment from source action as you are doing below.

 

Like and Mark this as a solution if this resolves your issue.

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Hi Prasad , Thanks for the reply.

When an item is changed, the condition is if  "Assigned to" not equal to Empty. Then move the items from the Legal Request list to the Team assignment list with attachments. Using the below Flow I am able to move the item but each attachment copies over as an individual item. How can I keep the attachments to one item?

 

PBala_0-1603392320075.png

PBala_2-1603392439937.png

Thanks

Hello @PBala 

You should apply the following steps:

1) Get the attachments of the modified item.

2) Create the item in a new list.

3) For each attachment:

3.1) Get the file content of the attachment

3.2) Add the file to the created item in a new list.

 

create_attachments.png

 

Hope it helps!

Ferran

 

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

Thanks Ferran , your step worked perfectly.

 

I have another question, how can update column values in  List 1 ( Timesheet) based on item change. 

 

The initial value for "Assignment Status" is Pending and when someone is assigned to, the value changes to Assigned and copies to list 2 with attachments.

 

 

I tried to do an Update list before the "Get attachments" step but created duplicate copies in List 2

 

PBala_0-1603403726119.png

 

Thank you so much for your help.

 

 

 

Hello @PBala 

You could update the item in List 1 in the last step of the "yes" condition branch using "Update SharePoint item" action.

 

Hope it helps!
Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!

I did but it creates multiple entries of the item in List 2. Like an infinite loop.  I am doing some silly mistakes, breaking my end.  I checked all my steps.

Thanks much

 

PBala_0-1603471211822.png

 

 

PBala_1-1603471335655.png

 

PBala
Helper II
Helper II

Hi , any help on this. I am getting duplicate items copied over, when the flow runs

PrasadAthalye
Community Champion
Community Champion

Create a new column in this source list which is of type Yes\No and call it ItemCopiedStatus.

 

Now write a trigger condition which checks if AssignedTo is not empty and ItemCopiedStatus is No. Flow will only run once as soon as AssignedTo is changed. Then you copy item and attachment as you have already done and SET ItemCopiedStatus = Yes.

 

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community
PBala
Helper II
Helper II

Thanks much for your suggestion, at least the infinite loop stopped, but it still copies over even with the assignment field empty. Any suggestion. Flow should trigger when an item is modified but when I submit an item, it copies over the item, even though the 'assigned to'  field is blank.

 

PBala_1-1621626275133.png

 

 

Any suggestions.

 

Thanks

 

 

 

 

PrasadAthalye
Community Champion
Community Champion

instead of leaving it empty can you click expression and type null? Also I recommend you to add this as a trigger condition it self so that Flow wont run on every update...

 

PrasadAthalye_0-1621629520755.png

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Worked  like a charm, thanks so much. Using trigger, my flow is much cleaner.

 

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,051)