cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Randomizing email design

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Kikoger
Resolver II
Resolver II

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

View solution in original post

3 REPLIES 3
efialttes
Super User
Super User

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

 

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Kikoger
Resolver II
Resolver II

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

@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



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,770)