Skip to main content

Notifications

Community site session details

Community site session details

Session Id : FDneXqOZlLzreqkUEZhYpu
Power Automate - Building Flows
Answered

Email to item owners from devops query

Like (0) ShareShare
ReportReport
Posted on 15 Jan 2019 14:40:16 by

I would like to send a reminder email to each work item owner from a devops query on a weekly basis.  I have a recurrence that calls a query, then an apply to each with a send email 2 inside.  Testing the flow manually correctly calls the query and returns the results, however, I cannot correctly extract the Assigned To and place it in the To field.  First, the fields from the current item do not appear in the dynamic content picker for the To field.  Second, the Assigned To field does not appear in the dynamic content picker for other slots like the subject or body.  Other fields like Title do appear in the dynamic contect picker.  I placed this in the email Subject and it populates correctly in the test.  

 

Any help would be appreciated.  

  • khenckel Profile Picture
    on 08 Jan 2020 at 21:50:48
    Re: Email to item owners from devops query

    Update 1/8/2020 - What worked for me is this. I needed to use Apply_to_each instead of For_each.

     

    • Manual trigger
    • Get query results
    • Apply to each
      • Select an output from previous steps: "value"
      • Send an email (V2)
        • To: "first(split(last(split(items('Apply_to_each')?['System.AssignedTo'],'<')),'>'))" (an expression; no quotes)
        • Subject: "Test"
        • Body: "Test"
  • DLan Profile Picture
    on 09 Jul 2019 at 22:13:15
    Re: Email to item owners from devops query

    "body": {
    "Body": "@{items('For_each')}",
    "Subject": "@items('For_each')?['System.Title']",
    "To": "@{first(split(last(split(items('For_each')?['System.AssignedTo'],'<')),'>'))}"
    }

     

    It doesn't give you the email in JSON.  Its something like "John Doe <johndoe@contoso.com>".  That magic up above gets out the email address.

  • tommytables Profile Picture
    Microsoft Employee on 09 Jul 2019 at 19:40:37
    Re: Email to item owners from devops query

    Darn, you wouldn't remember that particular Logic App?  Does anyone know how to parse this using JSON?

  • DLan Profile Picture
    on 09 Jul 2019 at 19:22:29
    Re: Email to item owners from devops query

    It's been a while, but I think I bumped this code up to a Logic App then I could get a hold of what I needed to.  Sorry I cant be more clear.  

  • tommytables Profile Picture
    Microsoft Employee on 09 Jul 2019 at 19:15:00
    Re: Email to item owners from devops query

    What functions did you use to pull out the emails?

  • tommytables Profile Picture
    Microsoft Employee on 09 Jul 2019 at 19:13:57
    Re: Email to item owners from devops query

    I am having similar issue when using a custom identity field in DevOps to send an item via email to update stake holders.  

     

    My flow attempts to send to "User Name <Username@domain.com>" instead of "username@domain.com" and fails.

     

    Please help.

     

     

  • Verified answer
    DLan Profile Picture
    on 16 Jan 2019 at 21:26:59
    Re: Email to item owners from devops query

    I'm sorry,  I can't figure out how to upload a screenshot.  

     

    I got this working as a Logic App.  There are two blocking issues.  First, for some reason I do not understand the DevOps connector in Flow does not pass along the "Assigned To" field.  All of the others are there, but AssignedTo is needed to figure out who to send the mail to.  Second the DevOps connector does not pass the value of this field as an email address.  It passes it as a contact e.g. "John Doe <john@doe.com>" and I needed to use several functions to pull out just the email address "john@doe.com".  Either DevOps should pass the email, or the email activity should accept the contact format like Outlook does.

     

    Thank you very much!

     

    Dave

  • v-yuazh-msft Profile Picture
    on 16 Jan 2019 at 05:55:13
    Re: Email to item owners from devops query

    Hi @DLan,

     

    Would you please share a screenshot of the configuration of your flow so we would try to provide a proper workaround for you?

     

    Best regrads,

    Alice

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,788 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,093 Most Valuable Professional

Leaderboard