We have a solution that was upgraded from 6.5 to 7.2. After this upgrade we are having issues where Item.Editing.EndEdit() no longer triggers item:saving/item:saved events. Therefore changes made to the item prior to the EndEdit() are not saved.

EventDisabler.IsActive is false and EndEdit() doesn't throw any exception. Anyone have any idea to what can be happening?

public void SetFieldValue(string itemId, string fieldName, string value)
    Database masterDB = Sitecore.Configuration.Factory.GetDatabase("master");
    var item = masterDB.GetItem(new ID(itemId));
    var valuefield = item.Fields[fieldName].Value;
    using (new Sitecore.SecurityModel.SecurityDisabler())
        item.Fields[fieldName].Value = valuefield + value;
  • Do you have any other issues after the update? Can you edit items normally in the Content Editor? Commented Oct 5, 2016 at 10:34
  • Are you using SecurityDisabler()? Commented Oct 5, 2016 at 10:59
  • 1
    Would you be willing to sanitize and provide a code snippet of how you are editing the item? If memory recalls, I do want to say that I remember having to specifically code ".EndEdit(false)". The first param of EndEdit(bool silent, bool updateStatistics) indicates whether or not the editing will remain silent and not fire events. I will have to decompile the 7.2 dll in the morning and provide a detailed answer for you tomorrow. Commented Oct 7, 2016 at 4:06
  • 1
    Also, what revision specifically of 7.2 are you on? Commented Oct 7, 2016 at 4:10
  • 1
    EditContext was declared obsolete in 2006. sitecore.alexiasoft.nl/2006/04/03/new-way-of-editing-items
    – Mark Cassidy
    Commented Oct 11, 2016 at 1:03

2 Answers 2


Response - Stop Gap Answer

I believe what is occurring is an error in the saving of the Item when updating the statistic. The reason I bring this up, is because of your information that the item doesn't save. In both versions 6.5 and 7.2, the functionality inside of the EndEdit action has been relatively consistent.

Try to save the item using the following: item.Editing.EndEdit(false,true);

This is a band-aid solution, to isolate where the error is occuring. If this yields additional information to formulate a solution, I'll adjust this answer as needed.

Why I Think This

If you look in the AcceptChanges() method:

/// <summary>Ends an edit operation.</summary>
/// <param name="updateStatistics">if set to <c>true</c> this instance is update statistics.</param>
/// <param name="silent">if set to <c>true</c> this instance is silent.</param>
/// <returns>The changes.</returns>
/// <remarks>
///     <para>Editing an item without calling BeginEdit throws an exception.</para>
///     <para>It is usually easier and more readable to using the EditContext class instead
/// of a BeginEdit and EndEdit pair.</para>
/// </remarks>
public bool AcceptChanges(bool updateStatistics, bool silent)
  bool readOnlyStatistics = this.m_item.RuntimeSettings.ReadOnlyStatistics;
    if (!updateStatistics)
      this.m_item.RuntimeSettings.ReadOnlyStatistics = true;
    if (!silent)
      return ItemManager.SaveItem(this.m_item);
    using (new EventDisabler())
      return ItemManager.SaveItem(this.m_item);
    this.m_item.RuntimeSettings.ReadOnlyStatistics = readOnlyStatistics;

The try{}finally{} is what I'm looking at. There is no catch, and no logging (at this point in the code) that something bad happened. It may not be getting far enough in the save item, which would then bomb the events.

Follow Up Suggestions

  1. Exam your Sitecore logs and make sure that there isn't an error message related to saving the item.
  2. Add some logging to your SetFieldValue() method to see if it's a particular field and/or value.

Issue was caused by an replacer being mode="on"

<replacer mode="on" id="publish" type="Sitecore.Text.Replacer, Sitecore.Kernel" singleInstance="true">

changing this setting to mode="off" fixes the issue:

<replacer mode="off" id="publish" type="Sitecore.Text.Replacer, Sitecore.Kernel" singleInstance="true">

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.