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

How to compile all "like" records from a table and send a single email?

Hello Folks -

 

I have a SP Table that is updated with "change requests" when an end user submits changes through a PowerApps application.  When that record is added to the table, an email notification goes out to the end user with the details. Sometimes, the end user submits many requests and each submission is a new email. In an effort to clean things up a bit, I was wondering if it's possible to recreate my flow to trigger at the end of each day (rather than real time) and send out a single email each row item?

I have many other flows where I create HTML tables and include the updates within the table as it makes for a very clean notification so I can always do that in this case. For instance:

 

hMTLTABLE.png

 

My question is, how do I just compile all row items added "today" from "user"? Would this be something I add to the "Filter Query"?  I'd need to loop through because every day multiple different users are submitting requests. 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @simms7400 :

The point is to write Filter Query.Please refer to my earliest reply.

1.JPG

Best Regards,

Bof

View solution in original post

11 REPLIES 11
Community Support
Community Support

Hi @simms7400 :

Do you want to filter out the records created on today?

Please try this solution:

1.JPG

 

Reference Expression:

 

formatDateTime(utcNow(),'yyyy-MM-dd')

 

 

v-bofeng-msft_1-1606714964658.png

 

 

The Result

v-bofeng-msft_2-1606714964659.png

 

Best Regards,

Bof

@v-bofeng-msft 

 

Not really.  Let me explain better.  I have a change request table and each time someone submits a change via PowerApps, a record is added to my Change Request SP List.  I currently have a Flow that sends out a notifcations anytime a new record is added.  However, there are times when 1 person makes multiple changes and as a result, gets multiple emails.

I"m looking for a way to send a single email to the user with all of his/her changes for the current day.

 

PA_ARRAY.png

Hi @simms7400 :

If you want to get the record of changes that occurred on the day, then just use Recurrence trigger and replace "Created" with "Modified".

Best Regards,

Bof

@v-bofeng-msftBut your solution will send an email for each row item...I"m looking to send a SINGLE email to the user with ALL of his/her requests for the CURRENT day.

 

Per my screen shot above, there is a single user who submitted 8 requests. I'm looking for a solution to send that user 1 email with all of the requests, instead of 8 individual emails...

Super User III
Super User III

This is what you need to do:

  1. Create a scheduled flow.
  2. Return all of the records of change requests made that day.
  3. Filter the results to create a list of usernames only
  4. Union the results of the filter with itself to create a unique list of usernames
  5. Loop around the usernames
    1. Within the loop filter the triggeroutput on username.
    2. Send an email to each user with their change requests for that day.

 

Does that make sense?

@Paulie78 

 

Thank you! Yes it does!!  Would you have any examples/screen shots on how to set up steps 3 through 5?

Community Support
Community Support

Hi @simms7400 :

Please try this flow:

1.JPG

Reference Expression:

1\

union(body('Select'),body('Select'))
2\
items('Apply_to_each')?['ModifiedBy']
3\
items('Apply_to_each')?['ModifiedBy']
Best Regards,
Bof

Thank you! @v-bofeng-msft 

 

How would I get get items created "today" from my SP list and feed it to your above flow?

Hi @simms7400 :

The point is to write Filter Query.Please refer to my earliest reply.

1.JPG

Best Regards,

Bof

View solution in original post

@v-bofeng-msft 

 

Thank you!! I have it working, although very primitive.  Currently, the HTML output is only including the "CreatedBy".  How would I include other columns from the list? I obviously can't put in the first select as that would make each row unique...

 

What I did was add another Get Items and include a similar Filter Query from the first one except this one I include another "And" statement to only pull the records based on the Email...is this the correct way to do this?

PA_Email.png

Community Support
Community Support

Hi @simms7400 :

The syntax looks ok,but:

  • The "/" in the column name is unrecognizable. I suggest you to change the name of this field ('Author/Email') in your SP list.
  • 1.JPG
  • The data type of'Author/Email' may also affect the result(I recommend using "Single Line of Text").

In addition,If you think the soltion I provided before can achieve your needs, please consider marking it as a solution to help others.

If you want to know more about how Filter Query works. I suggest you consider creating a new post for this.

Best Regards,

Bof

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Users online (3,773)