Hello Power Automate Community,
I’m currently working on building an automated workflow that responds to incoming emails and updates a SharePoint list based on the sender's email. The objective of the flow is to streamline communications by sending automatic replies and tracking interactions in a SharePoint list. Here’s an overview of my flow and the specific problem I’m encountering.
Flow Objective: The goal is to create a flow that:
Triggers when a new email arrives in the inbox. and for SharePoint using Get Items without any filter query as checking for all SharePoint list items.
Checks if the sender’s email is already recorded in a SharePoint list. Condition : length(body('Filter_array')) is greater than 0
If the sender is not found in the SharePoint list, sends an auto-reply and adds the sender's email to the list.
If the sender is found in the SharePoint list, checks the timestamp of the last interaction (recorded in the list). If more than 2 hours have passed since the last email, sends an auto-reply and updates the timestamp; otherwise, cancels the flow.
First Compose: sort(body('Filter_array'),'LastSentTimestamp','desc')
Second Compose: first(outputs('Compose'))
Condition: addHours(outputs('Compose_2')?['LastSentTimestamp'], 2) greater than utcNow()
Flow works fine for first time email. It sent email and also add records to SharePoint. But when new email arrives and records already exists in first sort it throw error
[
{
"@odata.etag": "\"1\"",
"ItemInternalId": "2",
"ID": 2,
"Title": "xyz@cont.com",
"LastSentTimestamp": "2024-11-29T05:48:59Z",
"RecipientEmail": "abc@cont.com",
"Modified": "2024-11-29T05:48:59Z",
"Created": "2024-11-29T05:48:59Z",
"Author": {
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims": "i:0#.f|membership|abc@cont.com",
"DisplayName": "ABC",
"Email": "abc@cont.com",
"Picture": "https://cont.sharepoint.com/sites/TestSite/_layouts/15/UserPhoto.aspx?Size=L&AccountName=abc@cont.com",
"Department": "Applications",
"JobTitle": null
},
"Author#Claims": "i:0#.f|membership|abc@cont.com",
"Editor": {
"@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
"Claims": "i:0#.f|membership|abc@cont.com",
"DisplayName": "abc",
"Email": "abc@cont.com",
"Picture": "https://cont.sharepoint.com/sites/TestSite/_layouts/15/UserPhoto.aspx?Size=L&AccountName=abc@cont.com",
"Department": "Applications",
"JobTitle": null
},
"Editor#Claims": "i:0#.f|membership|abc@cont.com",
"{Identifier}": "Lists%252fAutoReply%2blist%252f2_.000",
"{IsFolder}": false,
"{Thumbnail}": {
"Large": null,
"Medium": null,
"Small": null
},
"{Name}": "xyz@cont.com",
"{FilenameWithExtension}": "xyz@cont.com",
"{Path}": "Lists/AutoReply list/",
"{FullPath}": "Lists/AutoReply list/2_.000",
"{HasAttachments}": false,
"{VersionNumber}": "1.0"
}
]
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.