Skip to main content

Notifications

Power Automate - General Discussion
Answered

Personalize email body with Flow?

(0) ShareShare
ReportReport
Posted on by 6

Hey all, I've just started using flow but trying to learn as much as I can by looking through the documentation. I'm trying to create a flow that will forward an email all users within a specific department (based on the subject of the email, and whether or not it contains the department)

Is there something in flow I can use to pull the username of each corresponding user, and then have their name added to the body? I was looking through the Dynamic Content tags and couldn't find anything. Something like below:

"Hey [FIRST.NAME],

Here is the report for your department. Thanks!"

This will be the first of many personalized emails I'd like to set up with flow, and thought being able to add the user name to the body would be a nice touch.

  • v-bacao-msft Profile Picture
    v-bacao-msft on at
    Re: Personalize email body with Flow?

    Hi @rykiff ,

     

    I am not sure what Group you mentioned is specifically? Office 365 group or others? User info does not seem to contain this property.

    Please provide more details so that we could provide proper workaround.

     

    Best Regards,

  • rykiff Profile Picture
    rykiff 6 on at
    Re: Personalize email body with Flow?

    Hey Barry, this is fantastic! The iteration finishes successfully now. I'm not sure if this is exactly related to departments, but is there anyway to also differentiate user membership by group? If I could take these results, and pair them with a condition that sends only if they are a member or director, my flow would be complete. Seriously though, this is awesome, thanks for all your help!

  • Verified answer
    v-bacao-msft Profile Picture
    v-bacao-msft on at
    Re: Personalize email body with Flow?

    Hi @rykiff ,

     

    You could use Filter array to filter out the members of the corresponding department before using Apply to each.

    Alternatively, you could click on Apply to each-Settings to customize the degree of parallelism.

    Image reference:

    25.PNG26.PNG

     

    Best Regards,

  • rykiff Profile Picture
    rykiff 6 on at
    Re: Personalize email body with Flow?

    Hey Scott, thanks for the reply. The IndexOf expression definitely sounds like it would be a good option -- I'm  not too familiar with flow yet, but I'll be sure to use these as a good basis for some deep research this evening. I felt that the AzureAD connector would be the most useful for my use-case scenario, but unfortunately that functionality gives me a warning stating I need administrator approval, so I'll have to check with IT to see if there's anything I can do there. 

     

    Also Barry -- I really like your flow, the logic seems easy enough to follow, so I went ahead and set it up to test myself. I keep running into an issue where on the condition 'apply each' logic loop, it takes a bit of time (maybe around 30 seconds) and then timeouts after 100 iterations. My organization has about 700 active users -- is there an alternative way to search for users who match the department condition (as specified in the email subject)? One thing I should've mentioned in my OP is that users will also be members of one of two groups; either our 'Managers' group, or our 'Directors' group (totalling about 60 users total). Is it possible to make a condition that filters these users out first, and then compare the department to those 60 users instead of my entire organization? Thanks again for the replies, excited to get this flow going.

  • v-bacao-msft Profile Picture
    v-bacao-msft on at
    Re: Personalize email body with Flow?

    Hi @rykiff ,

     

    Please refer to the following method to configure Flow.

    • Configure Search for users action to get all the users in the organization.
    • Use Apply to each to traverse the Body to determine if the Subject contains a Department. If it is included, forward an email.

    Image reference:

    21.PNG

    Please take a try.

     

    Best Regards,

  • ScottShearer Profile Picture
    ScottShearer 25,150 on at
    Re: Personalize email body with Flow?

    @rykiff 

    Here is something that you can try:

    • Use the IndexOf expression to evaluate the message subject in order to determine if a group name appears in the subject
    • Use the AzureAD Get Group Members action to retrieve group members
      • You'll need to loop through the members returned and then send an email
      • I believe that the group members display name and email address are both returned by Get Group Members

    I haven't had time to test the AzureAD Get Group members action but it should work for you.

     

     

     

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard