Hi All,
I have a codeunit that contains many fuction.
I want to schedule only one function of this codeunit to be run automatically, every thing is OK with the NAS.
But I don't know how to configure the Job Queue.
What shall I put in the parameter string of the Job Queue Entry Card.
Thanks.
0
Comments
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
I can run a report with the job schedule,
but my problem is how to run only a function of codeunit with the job queue.
http://ssdynamics.co.in
RIS Plus, LLC
If I understand u well : If I ever want to run a function, must call it in OnRun(), It's Okay.
What I want is how to use the "Parameter String" field in the "Job Queue Entry" to execute my function and not another function that is in the OnRun trigger.
Thanks
RIS Plus, LLC
I found it !!!!!!!
This's my solution:
RIS Plus, LLC
I am able to have my nassql instance successfully execute reports for which I have created Job Queue Entries, and this is huge progress for me.
I am stuck on the Code Unit question. The previous posts seem to imply that:
- the OnRun() function of the codeunit will always run for the codeunit specified
- the way to implement the "Parameter String" is to create a global variable within the codeunit called "Parameter String", and then evaluate its contents
Are these two assumptions correct?
Problem 1: With no "Parameter String" specified, when my codeunit runs, the Job Queue Entry gets stuck in the "In Process" status and never finishes. The code in OnRun() is not executed.
Problem 2: I am unsure how to verify if the codeunit global variable is supposed to be titled "Parameter String", "ParameterString", "Parameter", or any other variant.
Problem 3: Even when I have a "Parameter String" specified on the Job Queue Entry card, the Job Queue Log Entries screen notes: "The codeunit was called with a Job Queue Entry record. It has no parameters."
In the previous sentence above, does "it" refer to the codeunit having no parameters or the Job Queue Entry having no parameters? Can you discern from my description where I misunderstand this process? Is there a web-based manual I can reference?
Thanks in advance for any thoughts.
Cheers-
Sam
U want to run a function in CU with NAS, right?
That's what u should do:
U should specify 'Job queue entry' as TableNo property of ur CU witch contains many function.
Then u write this code in the on run trigger:
The "Parameter String" isn't a global variable but a field of the 'Job queue entry' table.
After that u create a Job queue entry card.
and u fill in the "Parameter String" param1 if u want to execute function1 or param2 if u want to execute function2.
Hope that it will help u.
Ur Welcome
Sbilly
Thanks! I just saw your reply today.
I ended up finding some example code that was exactly what you suggested. It worked!
Thank you,
Sam
NAV 2009 SP1.
I need to run a CU, (SingleInstance = Yes) that resets any Job Queue Entry where the Status = "In Process".
The CU has a timer that checks the status every 30 seconds.
If I run it as a Job Queue and itself is stuck on "In Process", I am then unable to do anything with it except hope that a user will manually reset the job queue entries that need it.
1. Can I run my CU from CU1 or must I set it up as Job Queue Entry?
2. I am supposing that the NAS service runs CU1?
3. If I set it up as a Job Queue, then I need to understand how to use the Parameter string, any suggestions very welcome.
Thanks in advance,
Colin
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com
I have the following but not in the Job Queue:
OnRun()
IF ISCLEAR(autNavisionTimer) THEN BEGIN
CREATE(autNavisionTimer);
autNavisionTimer.Interval(30 * 1000);
autNavisionTimer.Enabled(TRUE);
END;
autNavisionTimer::Timer(Milliseconds : Integer)
CLEAR(JobQueueEntry);
JobQueueEntry.SETRANGE("Recurring Job" , TRUE);
JobQueueEntry.SETFILTER(Status , '%1', JobQueueEntry.Status::"In Process");
IF JobQueueEntry.FINDSET THEN BEGIN
WITH JobQueueEntry DO
REPEAT
JobQueueSetup.GET();
JobQueueSetup."Automation Active" := TRUE;
IF JobQueueSetup."Send E-Mail Error" THEN
SendErrorToMail.EMailError(JobQueueEntry);
LOCKTABLE;
Status := 0;
MODIFY;
UNTIL JobQueueEntry.NEXT = 0
END;
I am considering changing a few things such as, what caused the error and how to deal with it.
To do that, change the Status to "On Hold" and hope that the email will do the trick and get some human intervention.
Also, if the error is repeated as often as the job is run and it falls over, another email will be sent - that will irritate the recipients.