Use XML Variables in Invoke Form Activity
- Last UpdatedJul 01, 2024
- 3 minute read
Email templates can be used to display the values of the XML variables that have been created in a workflow.
Scenario
Scenario Requirements:
Assume that, 'Users' XML Variable of type XMLDocument is created in Start activity and schema is as follows:

The scenario requirement is that, during the workflow execution, you want to display the following values during the workflow execution.
-
ID is updated to 1029.
-
Email is updated to John.Smith@domain.com.
-
Name is updated to John.
-
Display these XML variable's value after "Submitted On" row in the Task Details Table.
Scenario Solution
To display the XML Variable's value in Invoke Form email and to display these 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 <%#XmlVariables.variablename%> placeholder in the html template for viewing the XML Variable's value. Where <variablename> is a name of the XML variable.
Since the 'Users' XML Variable contains the ID, Email, and Name, use the following XML Variables in the InvokeFormEmail.html template, where the values are to be displayed.
<%#XmlVariables.Users.User.ID%>
<%#XmlVariables.Users.User.Email%>
<%#XmlVariables.Users.User.Name%>
The highlighted portion in the below code displays the position where the above placeholders to be 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 bgcolor="#EFEFEF">
<b>User ID</b></td>
<td bgcolor="#EFEFEF">
<%#XmlVariables.Users.User.ID%></td>
</tr>
<tr>
<td>
<b>User Email</b></td>
<td>
<%#XmlVariables.Users.User.Email%></td>
</tr>
<tr>
<td bgcolor="#EFEFEF">
<b>User Name</b></td>
<td bgcolor="#EFEFEF">
<%#XmlVariables.Users.User.Name%></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 mail format for the above template:
