Trying to create my first codeunit

ZiqXx
Member Posts: 24
I am following the Hello World Navision Tutorial on MSDN and I have added this code to my codeunit:
I have also created these variables
But when I try to save the codeunit I get an error saying:
"Not an allowed option"
Does any one here know what I am doing wrong ?
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);
I have also created these variables
But when I try to save the codeunit I get an error saying:
"Not an allowed option"
Does any one here know what I am doing wrong ?
0
Comments
-
It's this line of code:
CC2::MessageReceived(VAR InMessage : Automation "''.IDISPATCH")
This is actually not supposed to be a statement, but it's an event.
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.0 -
Thank you so much, this was great. I am trying to learn how to do these codeunits and working with Navision that was great help. Much appriciated.0
-
Hello I have been trying to follow the Hello World Navision guide on MSDN, http://msdn.microsoft.com/library/defau ... vision.asp - And I have done everything but when I try to send to the queue's I get timed out, and when I restart the machine I get a lot of these message in my event viewer:
The description for Event ID ( 109 ) in Source ( NBX-NAVISION-CLASSIC ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: The network is not functioning correctly. A 'packet' has been corrupted (a checksum error). This error indicates that the network is not completely reliable. Please note how often this type of error occurs in the network. Contact your system manager if yo. --------------------------------------------------------------------------------- The description for Event ID ( 109 ) in Source ( NBX-NAVISION-CLASSIC ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: The Navision Application Server NBX-NAVISION-CLASSIC could not initialize properly. The server will attempt to initialize every 30 seconds until this is successful.
Does anyone here reconize these error messages ?0 -
Have you configured, ur NAS?0
-
http://mibuso.com/dlinfo.asp?FileID=608
Use it as an example, or maybe you can use it without coding, as it is.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions