CREATE(MQBus); CREATE(CC2); CREATE (XMLDom); CC2.AddBusAdapter(MQBus,1); MQBus.OpenReceiveQueue('.\toNavision',0,0); CC2::MessageReceived(VAR InMessage : Automation "''.IDISPATCH") // get the message InMsg := InMessage; InS := InMsg.GetStream(); // load the message into an XML document and find a node XMLDom.load (InS); XMLNode := XMLDom.selectSingleNode ('string'); // open the response queue and create a new message MQBus.OpenWriteQueue('.\fromNavision',0,0); OutMsg := CC2.CreateoutMessage('Message queue://.\fromNavision'); OutS := OutMsg.GetStream(); // build the contents of your message XMLNode.text := UPPERCASE (XMLNode.text); // fill the message and send it OutS.WRITE(XMLDom.xml); OutMsg.Send(0);
Comments
Go to your CC2 global and open the properties page. Set the WithEvents property to Yes. When you close the globals window, you should see a new event trigger called "CC2::MessageReceived", which fires each time a message is received into your communication component. Then move the code underneath your statement into the event trigger that Navision created.
If Navision doesn't add the trigger, you need to remove the CC2 variable, close and save your codeunit, and then add the variable again, and don't forget to set the WithEvents property.
By the way, it says 'not a valid option' because two colons is the notation to enumerate option values in C/AL code.
RIS Plus, LLC
Does anyone here reconize these error messages ?
Use it as an example, or maybe you can use it without coding, as it is.