I have implemented event handler for our bizforms , they all work perfectly well but I am still having issue with the custom tables see my code below and advise.Are the implementation for custom tables different from bizforms? It is suppose to update our CRM system.
[assembly: RegisterModule(typeof(CustTableventsModule))] namespace custTable { public class CustTableventsModule : CMS.DataEngine.Module { public CustTableventsModule() : base("CustTablevents") { }
// Contains initialization code that is executed when the application starts protected override void OnInit() { base.OnInit(); // Assigns custom handlers to events CustomTableItemEvents.Insert.After += CustomTable_Insert_After; } private void CustomTable_Insert_After(object sender, CustomTableItemEventArgs e) { CustomTableItem item = e.Item; if (item != null && item.CustomTableClassName.ToLower() == "customtable.producttype") { //string itemTextValue = item.GetStringValue("ProductName",""); string itemTextValue = ValidationHelper.GetString(item.GetValue("ProductName"), ""); string documentUrl = DocumentContext.CurrentDocument.NodeAliasPath.Replace("/", "-"); CRM.customtable(itemTextValue, documentUrl); } } }
}
Thanks Roma and David for getting back to me, I have resolved the issue, The documenturl was the issue in my code.
First of all what is your issue? Please provide more details
Second: are you sure document context is available in custom table item event handler?
And to answer your question - yes, they work almost the same way as biz form events.
Also are you using MVC or Portal?
When utilizing the MVC development model, you may need to deploy the assembly containing the event registration code and handler methods to the separate MVC application (in addition to the Kentico administration project). This is required if you are customizing any functionality that occurs on the live site. For example, if you have a custom handler for the Insert event of user objects, the event is raised both when creating a new user in the administration interface (Kentico application) and when a user registers on the live site (MVC application).
When utilizing the MVC development model, you may need to deploy the assembly containing the event registration code and handler methods to the separate MVC application (in addition to the Kentico administration project).
This is required if you are customizing any functionality that occurs on the live site. For example, if you have a custom handler for the Insert event of user objects, the event is raised both when creating a new user in the administration interface (Kentico application) and when a user registers on the live site (MVC application).
Please, sign in to be able to submit a new answer.