hopeless
hopeless

Reputation: 96

Kentico 11 - duplicate object is created after rollback

After I added versioning to a custom class (see https://devnet.kentico.com/articles/module-development-versioning-recycle-bin), the duplicated object is created (instead of just updating the existing one) when rollback feature is used.

Since I was asked for the exact steps that I took, here they are:

I have a custom class which is called StoreInfo. It contains a set of fields as Name, Address, Country, etc.

For enabling versioning, I added the following changes to the generated code:

public class StoreInfo : AbstractInfo<IndustryInfo>
{
    ...

    public static ObjectTypeInfo TYPEINFO = new ObjectTypeInfo(...)
    {
      ...
      SupportsVersioning = true
    };

    ...        
 
    protected override bool VersioningEnabled
    {
      get
      {
        return SettingsKeyInfoProvider.GetBoolValue("CMSEnableObjectsVersioning");
      }
   }
}

After this change was applied the Versions tab appeared in the UI interface:

enter image description here

Then I changed the name of the store from Test name to Test name 1, so Version 1.1 was added to the versions list:

enter image description here

The issue happened when I clicked this button:

enter image description here

Instead of updating the name of the existing Store back from Store name 1 to Store name it created a new store with the data of Version 1.0:

enter image description here

Any thoughts about why this happens would be helpful.

Kentico version is 11. (dev. approach - portal engine)

Upvotes: 0

Views: 83

Answers (1)

Brenden Kehren
Brenden Kehren

Reputation: 6117

If you deleted Object 1 and then created a "new" Object 1 and tried to roll back the deletion of the original Object 1, it will create a new one because they don't have the same attributes, especially the GUID.

So you may need to specify exactly the steps you took when you deleted the object, what you did after you deleted the object and what you did when you rolled back the original object.

Upvotes: 1

Related Questions