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

Apply to each variable is only capturing one input

I'm trying to create a variable that stores multiple SharePoint IDs.  The workflow is all based on attachments.  If there is more than one attachment in an email, the workflow will create a SharePoint item with a new ID for each attachment and then send/wait for an approval.  The flow is not returning any errors, but it is only updating the first SharePoint item when I have multiple approvals because the variable is only capturing the first SharePoint ID to come through from the approvals.  I need it to update the next SharePoint item as well.  Thoughts?

 

Screen Shot 2022-02-27 at 7.20.46 PM.png

Screen Shot 2022-02-27 at 7.22.48 PM.png

Screen Shot 2022-02-27 at 7.40.24 PM.png

  

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @LMT ,

 

The point is you are using "Set variable" in the first Apply to each which means you will only get the last ID because subsequent IDs always override previous IDs. To achieve your need, you actually need to initialize an array variable and in the first "Apply to each" use "Append to array variable" to get the array of all the IDs.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

2 REPLIES 2
v-jefferni
Community Support
Community Support

Hi @LMT ,

 

The point is you are using "Set variable" in the first Apply to each which means you will only get the last ID because subsequent IDs always override previous IDs. To achieve your need, you actually need to initialize an array variable and in the first "Apply to each" use "Append to array variable" to get the array of all the IDs.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

LMT
Frequent Visitor

Thanks, makes sense!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

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

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (3,311)