Here's an admin page to fix the issue specifically for WFFM forms.
you should change the dictionary to include/exclude the necessary changes for your specific situation. Add this as an aspx page below /sitecore/admin.
<%@ Page Language="C#" %>
<script runat="server" type="text/C#">
private bool authorized = false;
private string UnauthorizedMessage = "You are not authorized to view this page";
protected void Page_Load(object sender, EventArgs e)
{
if (!(true
//&& Request.IsSecureConnection // Check for HTTPS
&& Request.UserHostAddress == "127.0.0.1"
&& Sitecore.Context.IsLoggedIn
&& Sitecore.Context.IsAdministrator
//&& Sitecore.Context.User.IsInRole(@"sitecore\Developer") //check for specific role
))
{
Response.StatusCode = (int) System.Net.HttpStatusCode.Forbidden;
Response.Write(UnauthorizedMessage);
Response.TrySkipIisCustomErrors = true;
Response.End();
return;
}
else
{
authorized = true;
}
}
protected void FixFields_OnClick(object sender, EventArgs e)
{
if (!authorized)
{
output.InnerHtml = string.Format("<div style=\"color:red;\">{0}", UnauthorizedMessage);
return;
}
ID formTemplateId = new ID("{FFB1DA32-2764-47DB-83B0-95B843546A7E}");
ID contenTreeId = new ID("{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}");
ISearchIndex index = ContentSearchManager.GetIndex("sitecore_master_index");
string TrackingFieldName = "__tracking";
int changeCount = 0;
int errorCount = 0;
output.InnerHtml += "<div>Starting update of fields</div>";
Dictionary<string, string> replacements = GetReplacements();
List<Item> indexResults = null;
using (IProviderSearchContext context = index.CreateSearchContext())
{
indexResults = context.GetQueryable<SearchResultItem>()
.Where(x => x.TemplateId == formTemplateId
&& x.Paths.Contains(contenTreeId))
.Select(x => x.GetItem()).ToList();
indexResults = indexResults.Where(x => x != null).Where(x => x.Fields[TrackingFieldName] != null).ToList();
if (!indexResults.Any())
{
output.InnerHtml += "<div>No Form items found to modify. </div>";
return;
}
foreach (Item item in indexResults)
{
try
{
string value = item.Fields[TrackingFieldName].Value;
foreach (var dictionaryItem in replacements)
{
value = value.Replace(dictionaryItem.Key, dictionaryItem.Value);
}
item.Editing.BeginEdit();
using (new EditContext(item))
{
item.Fields[TrackingFieldName].Value = value;
output.InnerHtml += string.Format("<div>Item - {0} - changed</div>", item.Name);
}
item.Editing.EndEdit();
changeCount++;
}
catch (Exception ex)
{
output.InnerHtml += string.Format("<div>Item - {0} - {1}</div>", item.Name, ex.Message);
errorCount++;
}
}
}
output.InnerHtml += string.Format("<div>Update of tracking fields finished. {0} items modified, {1} errors ocurred. </div>", changeCount, errorCount);
}
private Dictionary<string, string> GetReplacements()
{
Dictionary<string, string> replacements = new Dictionary<string, string>();
replacements.Add("<event name=\"Field Changed\" />", "<event id=\"{AA3AE715-E87D-4B4D-80C7-4290546F770F}\" name=\"Field Changed\" />");
replacements.Add("<event name=\"Field Completed\" />", "<event id=\"{F0113A93-570A-4F69-8C7C-BA08037D1E34}\" name=\"Field Completed\" />");
replacements.Add("<event name=\"Field Not Completed\" />", "<event id=\"{7E86B2F5-ACEC-4C60-8922-4EB5AE5D9874}\" name=\"Field Not Completed\" />");
replacements.Add("<event name=\"Field Out of Boundary\" />", "<event id=\"{F3D7B20C-675C-4707-84CC-5E5B4481B0EE}\" name=\"Field Out of Boundary\" />");
replacements.Add("<event name=\"Invalid Field Syntax\" />", "<event id=\"{844BBD40-91F6-42CE-8823-5EA4D089ECA2}\" name=\"Invalid Field Syntax\" />");
return replacements;
}
</script>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>WFFM 8.2 fix tracking field</title>
</head>
<body>
<form id="trackingUpdater" runat="server">
<h3>Update tracking field for WFFM form items</h3>
<div style="margin-left:15px;">
Click the button below to fix the Tracking field for WFFM forms. This will add ID attributes to the selected items in this field.
Modify the dictionary to replace more/less as needed.
<br/><br/>
<asp:Button runat="server" ID="FixFields" OnClick="FixFields_OnClick" Text="Update form tracking field" />
</div>
<div id="output" runat="server" style="width: 1000px; height: 500px; overflow-scrolling: auto;">
</div>
</form>
</body>
</html>