the issue is the tracking field that was messed up during upgrade to the new WFFM version.... I've found a blog post below explaining the issue. Now I'm looking for a way to automate the fix.


I could use a powershell script, but I've logged a support ticket with sitecore to find a more standard approach. Does anyone have a clean way to fix this?

FYI here are the field values before and after the fix (in case others want to write a script):

raw values before fix:

<event name="Field Changed" />  
<event name="Field Completed" /> 
<event name="Field Not Completed" />  
<event name="Field Out of Boundary" />  
<event name="Invalid Field Syntax" />

raw values afer fix:

<event id="{7E86B2F5-ACEC-4C60-8922-4EB5AE5D9874}" name="Field Not Completed" />
<event id="{F3D7B20C-675C-4707-84CC-5E5B4481B0EE}" name="Field Out of Boundary" />
<event id="{844BBD40-91F6-42CE-8823-5EA4D089ECA2}" name="Invalid Field Syntax" />
<event id="{AA3AE715-E87D-4B4D-80C7-4290546F770F}" name="Field Changed" />
<event id="{F0113A93-570A-4F69-8C7C-BA08037D1E34}" name="Field Completed" />
  • A PowerShell script seems like a fine way to solve this issue. It looks like it could be just a straightforward string replace, searching for the various event names, which could be pulled from the event items themselves.
    – Kasaku
    Commented Mar 20, 2017 at 23:06

1 Answer 1


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 == ""
              && Sitecore.Context.IsLoggedIn
              && Sitecore.Context.IsAdministrator
            //&& Sitecore.Context.User.IsInRole(@"sitecore\Developer") //check for specific role
            Response.StatusCode = (int) System.Net.HttpStatusCode.Forbidden;
            Response.TrySkipIisCustomErrors = true;
            authorized = true;


    protected void FixFields_OnClick(object sender, EventArgs e)
        if (!authorized)
            output.InnerHtml = string.Format("<div style=\"color:red;\">{0}", UnauthorizedMessage);
        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>";

                foreach (Item item in indexResults)
                        string value = item.Fields[TrackingFieldName].Value;
                        foreach (var dictionaryItem in replacements)
                            value = value.Replace(dictionaryItem.Key, dictionaryItem.Value);

                        using (new EditContext(item))
                            item.Fields[TrackingFieldName].Value = value;
                            output.InnerHtml += string.Format("<div>Item - {0} - changed</div>", item.Name);
                    catch (Exception ex)
                        output.InnerHtml += string.Format("<div>Item - {0} - {1}</div>", item.Name, ex.Message);
            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;
   <!DOCTYPE html>
   <html xmlns="http://www.w3.org/1999/xhtml">
   <head runat="server">
       <title>WFFM 8.2 fix tracking field</title>
       <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.
               <asp:Button runat="server" ID="FixFields"    OnClick="FixFields_OnClick" Text="Update form tracking field" />
            <div id="output" runat="server" style="width: 1000px; height: 500px;    overflow-scrolling: auto;">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.