cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
288088
Post Partisan
Post Partisan

Something wrong with apply to each, sending email wrong

I got 2 items that have the condition TRUE for test in a sharepoint list.

 

So the first email is going out correct, looks like this:

 

Item 1:

Tekniker

Time

·  Carl Carlsson

·  Carl Carlsson

·  Carl Carlsson

·  Carl Carlsson

·  2020-03-30 14:00

·  2020-03-30 19:30

·  2020-03-30 11:00

·  2020-03-30 08:00

 

But then the flow goes again with item 2, but is combining item 1 and 2 so it looks like this:

 

Item 1 and 2 (Wrong):

Tekniker

Time

·  Carl Carlsson

·  Carl Carlsson

·  Carl Carlsson

·  Carl Carlsson

·  Henry Henrysson

·  Henry Henrysson

·  2020-03-30 14:00

·  2020-03-30 19:30

·  2020-03-30 11:00

·  2020-03-30 08:00

·  2020-03-30 12:00

·  2020-03-30 15:00

 

I want it to only send away an email with the info in item 2:

Tekniker

Time

·  Henry Henrysson

·  Henry Henrysson

·  2020-03-30 12:00

·  2020-03-30 15:00

 

Someone who might know what i'm doing wrong?

 

My flow:

2mailproblem.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

@288088 

 

You need to set the value of your string variable "Namn"(This is the name you have given to your string varaible) to null just before exiting the "Apply to each " action. Refer to below screenshot of flow for better understanding.

null.PNGSet variable action is clearing out the variable just before exiting the loop. By doing this when the loop enters the second time it will not have any previous values.

 

Thank You

Naveen Gupta

View solution in original post

7 REPLIES 7
Naveen_772
Advocate III
Advocate III

Hey @288088 

 

You are appending the result to a string variable. So every time the loop iterates it append value to the previous result.

 

Solution:- You need to clear the array "Namn" array. Add this action at the end of the apply to each loop.

 

I think this will solve your problem.

 

If you think I am able to help you then accept this as a solution.

 

Thanks and Regards

Naveen Gupta

I'm sorry, I dont know what you mean by:

 

"You need to clear the array "Namn" array. Add this action at the end of the apply to each loop."

 

Could you provide me with a picture or something?

 

Thanks for your effort really appreciate it

@288088 

 

You need to set the value of your string variable "Namn"(This is the name you have given to your string varaible) to null just before exiting the "Apply to each " action. Refer to below screenshot of flow for better understanding.

null.PNGSet variable action is clearing out the variable just before exiting the loop. By doing this when the loop enters the second time it will not have any previous values.

 

Thank You

Naveen Gupta

View solution in original post

Alright, I got it like this, what value should I put in "Compose"?

 

 

2mailproblem2.PNG

@288088 

 

I used compose just to represent the rest of your action between these "Append to String" and "Set Variable" action.

 

Thank You.

So I should put all this in the compose? Or get rid of the compose and just put convert time, send email etc. between "Append strinf" and "Set variable" ?

 

2mailproblem3.PNG

@288088 

 

Just get rid of the compose action and place all of your rest action in b/w them. I think this will solve the problem.

If I am able to solve your problem then please accept my answer as a solution.

 

Thank You.

Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (30,865)