Skip to main content

Notifications

Power Automate - Building Flows
Unanswered

Automating Email Responses and SharePoint Updates in Power Automate

Posted on 29 Nov 2024 07:21:43 by 52

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

 
Please help me to resolved this issue. 
 
  • Personallearn Profile Picture
    Personallearn 52 on 29 Nov 2024 at 07:32:23
    Automating Email Responses and SharePoint Updates in Power Automate
    Here I am also sharing run history of flow for existing email where flow failling. Please help me to resolved problem.
    Output of Filter Array: 

    [

      {

        "@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

        },

        "{Link}""https://cont.sharepoint.com/sites/TestSite/_layouts/15/listform.aspx?PageType=4&ListId=5950d4a3%2Da615%2D4dda%2D8090%2D49eb8c2ec85e&ID=2&ContentTypeID=0x0100C08C41F723E6B040AF792ABE6AEB8D4D00FECBE6064B3A6F42890CBCCEFE5D5919",

        "{Name}""xyz@cont.com",

        "{FilenameWithExtension}""xyz@cont.com",

        "{Path}""Lists/AutoReply list/",

        "{FullPath}""Lists/AutoReply list/2_.000",

        "{HasAttachments}"false,

        "{VersionNumber}""1.0"

      }

    ]

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,168

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,851

Leaderboard