|
||
When transferring data to a different instance of Kentico — via import/export or staging — IDs of the same objects can differ after the transfer. Kentico handles the situation for system objects, but not for custom objects. For example, when you stage a document type or a custom table that has a field containing object IDs, then the IDs are not guaranteed to stay the same once staged to the target server.
You can use the following two handlers to make sure the IDs are translated correctly:
RegisterRecords - use this handler to provide additional information for your custom field translation.
TranslateColumns - use this handler to translate the field value using the provided information.
You have a custom table that contains a UserID field. The field contains the ID of a user to whom the item belongs. Because the UserID field is a custom field, you want to ensure its correct translation during import/export and staging.
1. See how you can register the handlers.
2. Use the following code to ensure the correct translation of the UserID field.
[C#]
using System; private class CMSModuleLoaderAttribute : CMSLoaderAttribute { public override void Init() // Register the events if (e.ObjectType == CustomTableItemProvider.GetObjectType("customtable.sampletable")) if (e.ObjectType == CustomTableItemProvider.GetObjectType("customtable.sampletable")) |