Dear @Rico Yarde,
Thank you for reaching out to Microsoft Q&A forum. We are happy to assist you.
The issue you’re encountering is likely caused by the flow looping through all comments without properly filtering out those that have already been processed. Additionally, the timestamp comparison logic may not be accurately identifying only the newest comment, which results in multiple email notifications being triggered.
Based on your requirements, the intended outcome is to ensure that an email is sent only when a new comment is added to a SharePoint list item. To achieve this, the flow should be designed to compare each comment’s timestamp against a stored value (such as LastCommentTimestamp) and send notifications only if a newer comment is detected.
We recommend using Power Automate with the following suggestion:
Trigger the Flow:
In Power Automate, click Create > Scheduled cloud flow. Set the interval (e.g., every 5 minutes or every hour).
Click Create.
This will start your flow on a schedule, regardless of whether a SharePoint item was modified.
Retrieve the SharePoint Item
Add the “Get item” action.
Configure:
Site Address: your SharePoint site.
List Name: your list.
ID: use the ID from the trigger.
This retrieves the full item including custom columns like LastCommentTimestamp.
Get Comments via HTTP Request
Add “Send an HTTP request to SharePoint”.
Configure:
Method: GET
URI: _api/web/lists/getbytitle('YourListName')/items(ItemID)/Comments
Replace 'YourListName' and ItemID with dynamic values.
Parse the Comments Add “Parse JSON”.
Use the output from the HTTP request.
You can refer this schema:
{
"type": "array",
"items": {
"type": "object",
"properties": {
"createdDateTime": { "type": "string" },
"text": { "type": "string" },
"author": {
"type": "object",
"properties": {
"displayName": { "type": "string" },
"email": { "type": "string" }
}
}
}
}
}
Compare Timestamps Add “Initialize variable”:
Name: latestCommentDate
Type: String
Value: leave blank
Add “Apply to each” loop: use the parsed comments array.
Inside the loop:
Add a condition: comment.createdDateTime > LastCommentTimestamp
If true:
Set latestCommentDate to comment.createdDateTime.
Store comment.author and comment.text in variables.
Send Notifications
After the loop, add a condition: latestCommentDate is not empty.
If true: Add “Send an email (V2)” to the commenter.
Add another “Send an email (V2)” to the creator.
Update the SharePoint Item
Add “Update item”.
Set LastCommentTimestamp to latestCommentDate.
You might find it worthwhile to explore the suggestions provided above and see which approach aligns best with your specific requirements. Each method has its own merits depending on the complexity of your flow and the structure of your SharePoint environment.
That said, for scenarios involving advanced configurations or more intricate behaviors, I would kindly recommend sharing your query on the official Power Platform community forum. The forum is supported by a wide range of Microsoft experts and experienced users who specialize in deeper technical troubleshooting and can offer more tailored advice. This would be an excellent place to receive further guidance, especially if you're working with scenarios that extend beyond standard Power Automate logic.
If you need any further assistance or clarification, feel free to reach out. We're here to help. Thank you very much for your understanding and your cooperation.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.