OrderHelper.RegisterOrderSavedHandler problem

Discussions concerning general integration topics.

Moderator: Phil Barton

Post Reply
kqian
Posts: 68
Joined: Wed Feb 23, 2011 4:01 pm

OrderHelper.RegisterOrderSavedHandler problem

Post by kqian »

I use "OrderHelper.RegisterOrderSavedHandler" to register a event handler for saving order. It used to work well, but now it never gets called. The only thing I can think of that may be related is that I recently deleted all the records in "EventSubscription" and "EventNotification" tables in SelectDB when I was trying to solve my problem of getting Event Notifications.
Is that the cause for this problem? How can I fix it? Thanks.
Mark McKenna

Re: OrderHelper.RegisterOrderSavedHandler problem

Post by Mark McKenna »

The Order Helper hook and the Event Notification system are completely independent of one another. The former executes on the client machine under the Select process, and the latter executes on the mid-tier Select Server.

I would start by verifying that your package is successfully registering the event handler without encountering and/or swallowing any exceptions, and that your event handler is, indeed, not being invoked (e.g. ensure that the problem is the hook, and not whatever happens inside the delegate). Note that the save handler is only invoked when the order is saved inside the Select Shell environment.

Where are you registering the handler?
kqian
Posts: 68
Joined: Wed Feb 23, 2011 4:01 pm

Re: OrderHelper.RegisterOrderSavedHandler problem

Post by kqian »

I created a package and the handler was registered in the Oninitialize call. Under debugger I did see my package got loaded and the handler was registered. The order change was made inside the client shell. This worked fine before. Somehow it got broken ...

partial class MyPackage : Package
{
protected override void OnInitialize()
{
....
var orderHelper = this.GetService<OrderHelper>();
orderHelper.RegisterOrderSavedHandler(OrderSavedCommad_Invoked);
....
}
....
}
Mark McKenna

Re: OrderHelper.RegisterOrderSavedHandler problem

Post by Mark McKenna »

If you've verified that a trace point at the start of OrderSavedCommand_Invoked never gets hit, then I would suggest looking in the event viewer again (but on the client machine this time) for any errors that may be occurring. The handler should be invoked after the order is successfully saved without errors.
Post Reply