Use Variables in Choice Email Template
- Last UpdatedJun 10, 2024
- 2 minute read
Email templates can be used to display the values of the variables that have been created in a workflow.
Consider that a variable of type string by name 'Status' is created in the Start activity and its value is updated as Variable, status is updated. User wants to do the following:
-
Display the variable's value in Choice email.
-
Display the variable's value after Submitted on row in the Task Details Table.
Solution
To display this variable's value in Choice email and to display the variable's value after Submitted on row in the Task Details Table:
Steps:
-
Copy Choice.html file.
-
Use the <%#Variable.Variablename%> placeholder in the html template for viewing the variable's value where <Variablename> is a name of the variable.
Since the variable name is "Status", the placeholder to be used is <%#Variable.Status%> where the value is to be displayed. The highlighted portion in the below code displays the position where the <%#Variable.Status%> placeholder is added.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Mailer</title>
<style type="text/css">
<!--
.style2 {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}
.style4 {
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
font-weight: Normal;
color: #333333;
}
.Username {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: Bold;
color: #333333;
}
.subject {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: Bold;
color: #333333;
}
.style8 {
color: #FF3300;
font-weight: bold;
}
.style9 {font-family: Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; }
-->
</style>
</head>
<body>
<form id='Form1' action='<%#EmailURL%>' method='post' >
<table width="700" border="0" align="left" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td valign="top"><table width="100%" border="0" cellpadding="5" bgcolor="#FFFFFF">
<tr>
<td><span class="Username"><%#locSalutation%> <strong><%#ActorName%></strong></span>,
<p class="style2"><%#locMailDescription%></p></td></tr>
<tr>
<td bgcolor="#FFFFFF" class="style2"><%#Notes%> </td>
</tr>
<tr>
<td bgcolor="#EBEBEB">
<span class="style4"><%#loctaskInfo%></span>
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="50%">
<table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#999999">
<tr>
<td>
<table width="100%" border="1" cellpadding="6" cellspacing="0" bordercolor="#CCCCCC"
bgcolor="#FFFFFF" class="style2">
<tr>
<td width="21%" bgcolor="#EFEFEF">
<b><%#locName%></b></td>
<td width="79%" bgcolor="#EFEFEF">
<%#TaskName%></td>
</tr>
<tr>
<td>
<b><%#locDescription%></b></td>
<td>
<%#Description%></td>
</tr>
<tr>
<td bgcolor="#EFEFEF">
<b><%#locSubmittedBy%></b></td>
<td bgcolor="#EFEFEF">
<%#Submitedby%></td>
</tr>
<tr>
<td>
<b><%#locSubmittedOn%></b></td>
<td>
<%#SubmitedOn%></td>
</tr> <tr>
<td>
<b>Status</b></td>
<td>
<%#Variable.Status%></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br />
</td>
</tr>
<tr>
<td bgcolor="#EBEBEB" class="style2"><%#locRepondInTwoWays%></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="4" cellspacing="0" class="style2">
<tr>
<td><strong><%#locRespondbyMail%></strong></td>
</tr>
<tr>
<td style="padding-left:20px"><i><%#locReplyToMail%></i>
<table width='95%' border='0' align='center' bgcolor='#EBEBEB' cellpadding='5' cellspacing='1' style="width: 100%; height: 25px;">
<tr>
<td class="style2" width='30%' bgcolor='#EBEBEB'>
<strong>Column Name</strong></td>
<td class="style2" width='30%' bgcolor='#EBEBEB'>
<strong>User Input</strong></td>
<td class="style2" bgcolor='#EBEBEB'>
<strong>Valid User Input</strong></td>
</tr>
<tr valign="top">
<td class="style2" width='30%' bgcolor='#FFFFFF'>Comments:</td>
<td class="style2" width='30%' bgcolor='#FFFFFF'>[ ]</td>
<td class="style2" bgcolor='#FFFFFF'>[Free Text]</td>
</tr>
<tr valign="top">
<td class="style2" width='30%' bgcolor='#FFFFFF'>Action:</td>
<td class="style2" width='30%' bgcolor='#FFFFFF'>[ ]</td>
<td class="style2" bgcolor='#FFFFFF'>Enter:[<%#action%>]</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><strong><br /><%#locRespondByWeb%></strong></td>
</tr>
<tr>
<td style="padding-left:20px"><i><%#locWorkItemView%></i>
<br />
<a <%#workitemView%>><%#locWorkItemViewURLText%></a>
</td>
</tr>
</table></td>
</tr>
<tr bgcolor="#EBEBEB">
<td align="right" class="style2">
<span><a <%#docview%>><%#locDocViewURLText%></a></span>
|
<span><a <%#executionView%>><%#locExecutionViewURLText%></a></span>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="style2"><%#locSignature%></td>
</tr>
<tr>
<td bgcolor="#FFFFCC" class="style2"><table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="style2" width="95%"><span class="style8"><strong><%#locEmailSecurityWarning%></strong></span><br />
Workflow:{<%#ApplicationName%>:<%#EmailGUID%>:<%#WorkflowName%>}{WorkflowResourceActivityMail#3.5}{WorkflowFollowUp:<%#SkeltaFollowUpValue%>}{WorkflowReminderTime:<%#SkeltaReminderTimeValue%>}</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
-
The actor will get the Choice email in the defined format for the above template.
Note: Out of box variables such as <%#Variable.SubmittedBy.UserId%> , <%#Variable.SubmittedBy.UserName%>, and <%#Variable.SubmittedBy.UserDisplayName%> can be used for Active Directory provider.