Hello everyone!
My customer has to post item journal lines periodically. I create a report that it reads some lines and it creates records in to Item Journal Line table. I'd like to post these records but the job queue returns me an error that I cannot invoke dialogs.
Are there codeunits that I can invoke without dialog that they post Item Journal Line?
Thank you for your replies.
0
Comments
There is a function in navision to test the GUI. (GUIALLOWED)
So to run your process with nas you have to put GUIALLOWED before all dialogs.
Example :
IF GUIALLOWED THEN
Message('blablabla...');
Ok, I try it. Message and Error dialogs are need to be tested by GUIALLOWED function?
I modified the code wherever a dialog is being opened, closed or updated, and I also set it up to write the time of completion in a table, so that I would know that the reports ran successfully.
When I run the modified reports manually, they work without any problem.
But when run through NAS, they hit the following error (reported in the Job Queue Log Entry):
Another user has modified the record for Post Value Entry to G/L Value Entry No. '43134' after you retrieved it from the database.
Re-enter the changes in the updated window or start the activity again.
I thought that the dialog might be doing an implicit Commit, so I tried adding a Commit after each (commented out) dialog open / update / close, to see if this makes a difference.
But I’m still getting the same error when it runs through NAS.
Do you know what I could do?
Sound like a possible permissionerror
Dan Lindström
NCSD Navision 2.00 since 1999 (Navision Certified Solution Developer)
MBSP Developer for Microsoft Dynamics NAV 2009
I then commented out the COMMITs and tested again, and again it ran without error.
Note - I had made one other change besides commenting out the commits.
In the Post Inventory Cost to G/L report, I had commented out the following lines:
but of course I should only have commented out the Window.OPEN (and put a ; instead).
So it was that bugfix, and the service restart that solved the problem. No need for any commits.
I'll check again next week, after the users have posted several transactions, but I'm pretty sure that the problem is solved now.
P.S. My NAS service runs as Administrator, Administrator is a Windows login with the SUPER role in Navision, and the error message doesn't mention any permissions, so it wasn't a permission problem.
My problem was that I commented out another line too.
In general, we shouldn't even comment out the code, but put an IF condition as follows:
However, I had made a copy of Report 1002, which
(a) called report 795 and
(b) was only going to be called by NAS
So in this particular case it was OK to replace the Windows.OPEN with just a semicolon.