I'm tyring to use the Integration Bus to send new orders to an external ERP system.
My code looks like this:
public class ErpConnector : BaseIntegrationConnector
public override void Init()
ConnectorName = "ErpConnector";
public override IntegrationProcessResultEnum ProcessInternalTaskAsync(GeneralizedInfo infoObj,
TranslationHelper translations, TaskTypeEnum taskType, TaskDataTypeEnum dataType, string siteName,
out string errorMessage)
// Runs when processing Snapshot type tasks for order objects
if (infoObj.TypeInfo.ObjectType == OrderInfo.OBJECT_TYPE &&
dataType == TaskDataTypeEnum.Snapshot &&
taskType == TaskTypeEnum.CreateObject)
var orderInfo = (OrderInfo)(infoObj.MainObject);
I'm basically subscribing to changes to the OrderInfo object and execute my custom code if the taskType is CreateObject.
The problem is, when the OrderInfo object gets created, and my integration gets called, the addresses (Shipping or Billing) are sometimes null. It's a race condition. As far as I can tell from the Event Log, Kentico updates the order object one more time after creation. My guess is that Kentico creates the OrderInfo object first and adds the addresses later.
Here is a screenshot of the Event Log:
You can see that the first run of the integration failed, because of the NullReference on the address field. It worked fine during the second try a few seconds later.
Is that a bug in Kentico or am I doing something wrong? I don't really want to listen to the UpdateObject event because we only want to send the data once on the first creation of an order but no updates.
I'm using Kentico 12.0.31.