cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MKT
Regular Visitor

Collecting List Items and Associated Comments to Display in Email

Hello,

I’m using “GET” to capture all list items that have a ‘canceled’ status.  Then adding a “Send HTTP Request to SharePoint” to capture the associated list comments, for those items.  When my FLOW runs, it only outputs the items that actually have comments and ignores the other canceled items.  I wish to send an email containing ALL canceled items with their associated comments and display N/A, if no comments exist.  Can someone please advise what steps I might be missing here and how I need to adjust my FLOW?  I’m very new to Power Automate, so any assistance, especially with screen shots is appreciated. 

 

MKT_0-1631232226253.png

 

MKT_1-1631232226258.png

 

MKT_2-1631232226260.png

 

MKT_3-1631232226262.png

 

Thank you,

MKT

1 ACCEPTED SOLUTION

Accepted Solutions
ekarim2020
Community Champion
Community Champion

Here is a flow that grabs all comments for a SharePoint List and sends them as an email.

ekarim2020_28-1631313503582.png

The body of the email consists of the SharePoint item ID followed by the comments, if any:

ekarim2020_12-1631310970714.png

Here is the high-level flow:

ekarim2020_27-1631313217401.png

Staring with Get items, and initializing variables:

ekarim2020_15-1631311207747.png

(2) Apply to Each loop -  for each SharePoint list item, get the comments using a SharePoint REST API:

ekarim2020_17-1631311291812.png

Use Send HTTP request to SharePoint to get the list item comments:

ekarim2020_19-1631311499650.png

 

 

_api/web/lists/getbytitle('Managers List')/items(@{items('Apply_to_each')?['ID']})/Comments

  "accept": "application/json;odata=verbose",
  "content-type": "application/json;odata=verbose"

 

 

Store the comments in a compose action. Note the comments are returned as an array.

ekarim2020_20-1631311586348.png

 

 

Compose action:
@{outputs('Send_an_HTTP_request_to_SharePoint')?['body/d/results']}

 

 

Now check to see if there are any comments :

ekarim2020_21-1631311773320.png

 

 

length(outputs('Compose_Results'))

 

 

ekarim2020_24-1631312415941.png

Yes, true condition - there are comments:

ekarim2020_26-1631312926825.png

No, false condition - there are NO comments:

ekarim2020_23-1631312355813.png

Finally the send mail action:

ekarim2020_25-1631312541342.png

ekarim2020_12-1631310970714.png

 

Hope this provides some guidance.

Ellis

View solution in original post

5 REPLIES 5
MKT
Regular Visitor

Adding a summary screen shot of entire flow:

MKT_0-1631296989289.png

 

ekarim2020
Community Champion
Community Champion

See the following post: Get Microsoft Lists Comments using Flow

https://powerusers.microsoft.com/t5/Building-Flows/Get-Microsoft-Lists-Comments-using-Flow/m-p/78741...

Ellis

MKT
Regular Visitor

Thanks Ellis, I am able to get the comments.  My problem is figuring out how to output items in an email that don't have comments, along with those that do.  

 

Thanks,

MKT

ekarim2020
Community Champion
Community Champion

Here is a flow that grabs all comments for a SharePoint List and sends them as an email.

ekarim2020_28-1631313503582.png

The body of the email consists of the SharePoint item ID followed by the comments, if any:

ekarim2020_12-1631310970714.png

Here is the high-level flow:

ekarim2020_27-1631313217401.png

Staring with Get items, and initializing variables:

ekarim2020_15-1631311207747.png

(2) Apply to Each loop -  for each SharePoint list item, get the comments using a SharePoint REST API:

ekarim2020_17-1631311291812.png

Use Send HTTP request to SharePoint to get the list item comments:

ekarim2020_19-1631311499650.png

 

 

_api/web/lists/getbytitle('Managers List')/items(@{items('Apply_to_each')?['ID']})/Comments

  "accept": "application/json;odata=verbose",
  "content-type": "application/json;odata=verbose"

 

 

Store the comments in a compose action. Note the comments are returned as an array.

ekarim2020_20-1631311586348.png

 

 

Compose action:
@{outputs('Send_an_HTTP_request_to_SharePoint')?['body/d/results']}

 

 

Now check to see if there are any comments :

ekarim2020_21-1631311773320.png

 

 

length(outputs('Compose_Results'))

 

 

ekarim2020_24-1631312415941.png

Yes, true condition - there are comments:

ekarim2020_26-1631312926825.png

No, false condition - there are NO comments:

ekarim2020_23-1631312355813.png

Finally the send mail action:

ekarim2020_25-1631312541342.png

ekarim2020_12-1631310970714.png

 

Hope this provides some guidance.

Ellis

View solution in original post

MKT
Regular Visitor

  • Thanks for all the detail Ellis, this worked perfectly.  Appreciate your help! 

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 (1,638)