Use Variables in Invoke Form Activity
- Last UpdatedJul 01, 2024
- 2 minute read
Email templates can be used to display the values of the variables that have been created in a workflow.
Scenario
Scenario Requirements:
Assume that, variable of type string by name 'Status' is created in Start activity and its value is updated as "Variable, status is updated".
You want to,
-
Display the variable's value in Invoke Form email.
-
Display the variable's value after "Submitted On" row in the Task Details Table.
Scenario Solution
To display this variable's value in Invoke Form email and to display the variable's value after "Submitted On" row in the Task Details Table, the following steps need to be followed:
Steps:
-
Copy InvokeFormEmail.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.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
}
.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>
<table width="700" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC" >
<tr>
<td valign="top"><table width="100%" border="0" cellpadding="5" bgcolor="#FFFFFF">
<tr>
<td><p><span class="Username">@@Dear@@ <%#ActorName%></span>, </p>
<p class="style2"><%#Body%></p></td>
</tr>
<tr>
<td bgcolor="#EBEBEB"><span class="style4">@@Task Information@@ </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="0" 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>@@Name@@</b></td>
<td width="79%" bgcolor="#EFEFEF">
<%#TaskName%></td>
</tr>
<tr>
<td>
<b>@@Description@@</b></td>
<td>
<%#Description%></td>
</tr>
<tr>
<td bgcolor="#EFEFEF">
<b>@@Submittedby@@</b></td>
<td bgcolor="#EFEFEF">
<%#Submitedby%></td>
</tr>
<tr>
<td>
<b>@@Date@@</b></td>
<td>
<%#SubmitedDate%></td>
</tr>
<tr>
<td bgcolor="#EFEFEF">
<b>@@Time@@</b></td>
<td bgcolor="#EFEFEF">
<%#SubmitedTime%></td>
</tr>
<tr>
<td>
<b>Status</b></td>
<td>
<%#Variable.Status%></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><span class="style2"><a href="<%#IntranetUrl%>/Form/WorkItemViewEmail.aspx?<%#QueryString%>">@@Click here@@</a> @@to view the form@@</span></td>
</tr>
<tr>
<td class="style2"><span class="style2">@@Or@@ </span></td>
</tr>
<tr>
<td class="style2"><span class="style2">@@Copy the below mentioned link in the browser area to view the form@@</span></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><span class="style2"><%#IntranetUrl%>/Form/WorkItemViewEmail.aspx?<%#QueryString%></span></td>
</tr>
<tr bgcolor="#EBEBEB">
<td align="right" class="style2">
<span><a href="<%#IntranetUrl%>/Emaildocview.aspx?<%#DocViewQueryString%>">@@Document View@@</a></span>
|
<span><a href="<%#IntranetUrl%>/EmaiExecutionView.aspx?<%#ExecutionViewQueryString%>">@@Current Execution Status@@</a></span>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="style2"><strong>@@Regards@@,</strong><br />
@@Skelta Admin@@</td>
</tr>
</td>
</tr>
</table>
</body>
</html>
The actor will get the following Invoke Form email 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.