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!
Solved! Go to Solution.
Hi,
if I understood you right, you can achieve this as follows:
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
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:
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
Proud to be a Flownaut!
Hi,
if I understood you right, you can achieve this as follows:
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
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
Proud to be a Flownaut!
User | Count |
---|---|
6 | |
5 | |
3 | |
3 | |
2 |