Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8832

Synchronizing objects

$
0
0
Hello,I have created data in a custom module that has a SiteID field reference. When I try to synchronize the object to another server I get a error message result.SyncServer.ServerError: Exception occurred: Cannot translate columns 'SiteID', import the dependent objects first.I have added the RegisterRecords and TranslateColumns handlers on both source and target servers but it doesn't seem to work. Does anyone have any ideas?private void RegisterRecords_Execute(object sender, ColumnsTranslationEventArgs e) { // Registers custom column translation data if (e.ObjectType == URLRedirection.RedirectionTableInfo.OBJECT_TYPE) { // Gets the site ID from the data int siteId = ValidationHelper.GetInteger(e.Data.GetValue(@SiteID@), 0); // Prepares parameters for the translation TranslationParameters parameters = new TranslationParameters(URLRedirection.RedirectionTableInfo.OBJECT_TYPE) { CodeName = SiteInfoProvider.GetSiteInfo(siteId).SiteName }; // Maps the site ID value to the corresponding site name for every record // Adds the mapping information into the export package CMS.EventLog.EventLogProvider.LogInformation(@RegisterRecords@, @Execute@, @siteID: @ + siteId + @ codename: @ + parameters.CodeName + @ Data: @ + e.Data.ToJSON(@@, false)); e.TranslationHelper.RegisterRecord(siteId, parameters); } } private void TranslateColumns_Execute(object sender, ColumnsTranslationEventArgs e) { // Performs column translation if (e.ObjectType == URLRedirection.RedirectionTableInfo.OBJECT_TYPE) { // Translates the values of the SiteID field in the table's data // Uses the mapping information in the import package to find the correct IDs based on the usernames CMS.EventLog.EventLogProvider.LogInformation(@TranslateColumns@, @Execute@,@CurrentSiteID: @ + SiteContext.CurrentSiteID + @ Data: @ + e.Data.ToJSON(@@, false)); e.TranslationHelper.TranslateColumn(e.Data, @SiteID@, URLRedirection.RedirectionTableInfo.OBJECT_TYPE, SiteContext.CurrentSiteID, true, true); } } Thank you,

Viewing all articles
Browse latest Browse all 8832

Trending Articles