Events from an automation class inside Navision

Kenny_VaesKenny_Vaes Member Posts: 8
Hi all,

I'm having some problems again. I've created an ActiveX-EXE project in VB6 and use it in navision for automation.

I've declared public events in the class so navision could see when something was moved, ....
Public Event OnMove(orderNo As String, truckcode As String)

In a function I then do:

RaiseEvent OnMove("Test", "Test")

So, when I add the automation variable in navision and set the propperties to With events: Yes. I see the events. But when I enter code into it like a MESSAGE('test'); for instance, nothing happens :(

Can anyone help me out here?

Thanks

Comments

  • Kenny_VaesKenny_Vaes Member Posts: 8
    I just tested the application from a VB .NET application and they do get triggered there. Do I need to do anything special in navision to get them triggered? :shock:

    In navision I do:
    1. CREATE(AutomationObject);
    2. Set the properties to withevents
    3. Inside the trigger in C/AL code i write: MESSAGE('Test');
    4. Run the AutomationObject
  • janpieterjanpieter Member Posts: 298
    Hi,

    To me it seems you are doing nothing wrong.

    But in my experience sometimes triggers are not executed and i think it has something to do with how busy your system is. So try to do a test by stripping down as much as possible.

    Ask these questions:
    - Is navision busy at the moment the event is triggered?
    - Is you VB DLL busy when the event is triggered?
    If yes to any of those this may be a problem (see it as a navision bug then)

    I don't know if this can cause behavoir that stops the trigger from execution but this is what i suspect to be a possible cause.

    I once made a custom raiseevent that temporary stores the event in a global var of the VB program and when execution was suspended i actually raised the event. This seemed to work better.

    Also maybe it helps playing arround with defining the event arguments as ByVal or ByRef. Maybe this makes a difference as well.

    Though i do not know if any of these possible sollutions will work.

    Good luck.
    In a world without Borders or Fences, who needs Windows and Gates?
  • DenSterDenSter Member Posts: 8,307
    Looks to me like you have an event called OnMove, so I am assuming that you have something visual then? Navision doesn't like visual components, but I don't know much about the details.
  • Kenny_VaesKenny_Vaes Member Posts: 8
    Thanks for the replies. I found a solution though....

    Setting the codeunit's properties to "Single Instance: Yes" did the trick
  • EugeneEugene Member Posts: 309
    my automation with events worked fine in NAV 2009 but the events do not get fired under NAV 2013 (i use Role Tailored Client side) even though the declarations of the events triggers are generated by navision
Sign In or Register to comment.