Hi Power Automate,
Have setup as follows: SharePoint List with a form for users to fill up --> Power Automate that auto-sends an email at specified time.
Am currently setting up the 'Send an email' module in Power Automate.
Like to prepare the email such that different categories are grouped and default value is "None".
Could an "If" condition with Dynamic Content be done in the 'Send an email' module?
Along the lines of "If, then, else": If([Movement]="Medical Leave",[Name of Person],"Null")
Email should look like:
Medical Leave
Person A
Person B
Fieldwork
None
Thanks in advance for helping.
Solved! Go to Solution.
@Sportynick one way you do this is shown below.
After your trigger, initialize string variables for each type of reason. Then get the items from your SharePoint list:
Add a switch on the reason and add a case for each for each reason (fieldwork, Medical Leave etc). It will get wrapped in an apply to each.
In each case add an append to string variable and add the relevant column from the dynamic content followed by <br>
Outside of the apply to each add the send an email action and make sure you select the </> icon so you add in the line breaks and it takes account of the line break in the step above.
The result is as follows:
Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.
As a follow on to the previous email, script currently does not work as it should.
Instead of displaying one email with desired format (e.g. Medical Leave - Person 1, Fieldwork - Person 2), if I have two records in SharePoint list, two emails are sent out showing:
1st Email:
Medical Leave
Person 1
Fieldwork
Person 1
2nd Email:
Medical Leave
Person 2
Fieldwork
Person 2
Extract of current script:
A. <u>Medical Leave</u><br>
<% if (@{items('Apply_to_each')?['Movement/Value']} = "Medical Leave") %>
<% { %>
<tr valign="top">
<td align="right">@{items('Apply_to_each')?['Person/DisplayName']}</td>
</tr>
<% } %>
<br>
<br>
@Sportynick one way you do this is shown below.
After your trigger, initialize string variables for each type of reason. Then get the items from your SharePoint list:
Add a switch on the reason and add a case for each for each reason (fieldwork, Medical Leave etc). It will get wrapped in an apply to each.
In each case add an append to string variable and add the relevant column from the dynamic content followed by <br>
Outside of the apply to each add the send an email action and make sure you select the </> icon so you add in the line breaks and it takes account of the line break in the step above.
The result is as follows:
Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.
Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
User | Count |
---|---|
34 | |
15 | |
15 | |
13 | |
7 |
User | Count |
---|---|
42 | |
32 | |
25 | |
12 | |
12 |