Run codeunit from outside NAV

cernst
Member Posts: 280
I've seen some post to run codeunits from outside NAV but they all use som kind of listener.
Is there any way to run a codeunit from outside NAV without using any automations that listen for events?
Is there any way to run a codeunit from outside NAV without using any automations that listen for events?
_____________________
NAV Freelance Consultant
NAV Freelance Consultant
0
Comments
-
Only by starting Navision itself.
eg:"C:\Program Files\Navision\5.01\finsql.exe" ID=RUN-C50099,servername=NAVSVR,database=Navision,ntauthentication=Yes,company=TVision Technology Ltd
Then in codeunit 1 at the end of Function "LogInStart"IF CODEUNIT.RUN(CODEUNIT::"Autostart control") THEN ;
Then in the OnRun of codeunit "Autostart control"I := STRPOS(UPPERCASE(COMMANDLINE), 'ID='); IF I = 0 THEN EXIT ELSE BEGIN Str := COPYSTR(COMMANDLINE, I+3); I := STRPOS(Str, ','); IF I > 0 THEN BEGIN IF I > 1 THEN Str := COPYSTR(Str, 1, I-1) ELSE Str := ''; END; I := STRPOS(Str, '-C'); IF I = 0 THEN EXIT; Str := COPYSTR(Str, I+2); IF NOT EVALUATE(CodeunitNo, Str) THEN EXIT; CODEUNIT.RUN(CodeunitNo); END;
The problem, of course, is exiting Navision once the codeunit has finished. Perhaps you can do some sendkeys stuff to simulate an Alt-F4. I have a few bits of code that will crash Navision ... but that's not very nice.
More likely a better solution is to look for an automation and start Navision if it's not there before trying again.Robert de Bath
TVision Technology Ltd0 -
maybe this?
viewtopic.php?f=7&t=158790 -
Found this one http://techblog.byllemos.com/?p=42 can start a form and thats ok for my current need.
Thx all._____________________
NAV Freelance Consultant0
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