How to schedule a Code Unit using NAS
premnav
Member Posts: 43
Hi Everybody,
I am having a problem where I just need to automate a posting using NAS. I know this is possible with NAS. In fcat I was able to setup an application server and I have defined a startupparameter when setting up the NAS. In the 'ApplicationManagement' code unit, I am trying to catch this varibale in the NASHandler event by placing the following code
IF (COPYSTR(Parameter,1,6) = 'MIBUSO') THEN
CODEUNIT.RUN(CODEUNIT::"Some Code Unit");
MIBUSO is the startupparameter given when setting up the Application server;
In the OnRun event of the code unit (Some Code Unit), I have given the following codes;
CREATE(autNavisionTimer);
autNavisionTimer.Interval(60000); // this will trigger every 10 seconds
autNavisionTimer.Enabled(TRUE);
MESSAGE('The NAS has been started.');
REPORT.RUN(6);
In the above codes, autNavisionTimer is defined as a follows
Name : autNavisionTimer
Type : Automation
Sub type : 'Navision Timer 1.0'.Timer
As you could see, I am trying to call the report at the end of the code,
Still I am unable to automate my posting. Can somebody suggests where I have done the mistake ? At the same time, I would like to know whether I have missed anything. I would greatly appreciate your ideas on this?
Thank you in advance,
PREMNAV
I am having a problem where I just need to automate a posting using NAS. I know this is possible with NAS. In fcat I was able to setup an application server and I have defined a startupparameter when setting up the NAS. In the 'ApplicationManagement' code unit, I am trying to catch this varibale in the NASHandler event by placing the following code
IF (COPYSTR(Parameter,1,6) = 'MIBUSO') THEN
CODEUNIT.RUN(CODEUNIT::"Some Code Unit");
MIBUSO is the startupparameter given when setting up the Application server;
In the OnRun event of the code unit (Some Code Unit), I have given the following codes;
CREATE(autNavisionTimer);
autNavisionTimer.Interval(60000); // this will trigger every 10 seconds
autNavisionTimer.Enabled(TRUE);
MESSAGE('The NAS has been started.');
REPORT.RUN(6);
In the above codes, autNavisionTimer is defined as a follows
Name : autNavisionTimer
Type : Automation
Sub type : 'Navision Timer 1.0'.Timer
As you could see, I am trying to call the report at the end of the code,
Still I am unable to automate my posting. Can somebody suggests where I have done the mistake ? At the same time, I would like to know whether I have missed anything. I would greatly appreciate your ideas on this?
Thank you in advance,
PREMNAV
0
Answers
-
1. Read this post viewtopic.php?f=23&t=36032&hilit=timer
I think this hold all the answers to your questions.
Remember, Codeunit = SingleInstance and automation with events!
2. Using the built-in scheduler, but this will cost you if I'm correct (license)0 -
Enable "WithEvents" on the timer. Put the code into the event.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K 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
- 324 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
