web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Randomizing email design
Power Automate
Answered

Randomizing email design

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

 

Is there a way to randomize emails sent via Power Automate Outlook connection? Let's say, I have three different email designs and I want to send a random one when the flow is triggered.

 

Any help would be appreciated. Thanks!

Categories:
I have the same question (0)
  • efialttes Profile Picture
    14,756 on at

    Hi!

    Yes, I believe so. there is a WDL function called rand(), so assuming you have 3 email body designs you can just store them in three 'Compose' action blocks,let's name them 'Compose 1', 'Compose 2', 'Compose 3'.

    Then add an 'Initialize variable' action block, type string let's call it 'TargetBody', then add a 'Switch' action block, assign as its input the following expression:

    rand(1,4)

    So you just need to define 3 branches for the Switch (values 1, 2 and DEfault for 3).

    Inside branch 1, add a 'SEt variable' action block, name 'TargetBody', assign as its value the following expression:

    outputs('Compose_1')

    Inside branch 2, add a 'SEt variable' action block, name 'TargetBody', assign as its value the following expression:

     

    outputs('Compose_2')

    Inside branch Default, add a 'SEt variable' action block, name 'TargetBody', assign as its value the following expression:

     

    outputs('Compose_3')

    Now, out of your Switch, add a 'SEnd an email' action block, assign as its value variable 'TargetBody'

     

    If you are unfamiliar with WDL expressions, please follow these steps to add them:

    https://youtu.be/LPZ-WZoWwp4

     

    Please let us know your progress, if you find any issue implementing this approach do not hesitate to share a screenshot from your flow design and the problem encountered

    Hope this helps

     

     

  • Verified answer
    Kikoger Profile Picture
    221 on at

    Hi,

     

    if I understood you right, you can achieve this as follows:

     

    rand.png

     

    Create a switch with options 1, 2 and 3 and set the On expression to rand(1, 3). It will generate a random value between 1 and 3 and will then send email 1, 2 or 3.

     

    Max

  • efialttes Profile Picture
    14,756 on at

    @Kikoger

    That's the idea, but... if you add the 'Initialize variable', 'Set variable' stuff you can test this approach 3-4 times just before adding 'Send an email', so you will not disturb anybody else while testing.

    Hope this helps

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 103 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 87

#3
trice602 Profile Picture

trice602 63 Super User 2026 Season 1

Last 30 days Overall leaderboard