Talking to Navision

vaibhav_soulvaibhav_soul Member Posts: 17
Hi all,

I am having an issue with talking to Navision. I am trying to implement the simple example that uses message queues (as outlined in the Talking to navision document).

The OnRun of the single instance code unit looks like -
Code:
CREATE(Comcom); 
CREATE(MSMQBus); 
Comcom.AddBusAdapter(MSMQBus,1); 
MSMQBus.OpenReceiveQueue('hgnb_07\private$\salesorder',1,1); 


The Comcom::MessageReceived(VAR InMessage : Automation "''.IDISPATCH") trigger looks like -
Code:
MESSAGE('hello world'); 
InMsg := InMessage; 
InStr := InMsg.GetStream; 
InStr.READTEXT(Line); 
IF Line = 'Sales Order' THEN 
BEGIN 
  MESSAGE(Line); 
END 
ELSE 
BEGIN 
    MESSAGE('Not a sales order'); 
END; 


The trigger does not seem to run at all when messages are within the message queue or when a new message has entered into the mq.

I do not understand what is wrong in here as I followed exactly as described by the article. I am sure that leaving the trigger everything else is working fine. However, why isnt the trigger getting triggered???? Can anyone please help me out?? [-o<

Comments

  • vaibhav_soulvaibhav_soul Member Posts: 17
    ok.. i think the above trigger is for XML messages. Does this mean that the trigger would not work for normal messages? If so, can anyone guide me which trigger I would need to use for normal messages? Thanks.
  • kinekine Member Posts: 12,562
    The trigger will be fired, if message with correct label will be placed into the queue. Look into the example, which label is used. Also you can search this forum for the examples.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • MalajloMalajlo Member Posts: 294
    Did you run CU in SingleInstance mode?
    Reading messages (regardless XML or text) you have to try saving in txt file if you are not sure what is comming in (out).
Sign In or Register to comment.