Posting Sales Orders using NAS

ALopez27
Member Posts: 42
NAV Gurus,
I've looked at entire forum but cannot find an answer to my specific problem, which is the following:
I've created a codeunit that will post ship sales orders using the Navision Application Server, I have modified CU80 (Sales-Post) to supress all instances of any dialog windows from opening or updating (was getting error 'You cannot use C/AL variables of type DIALOG when running the Application Server for Microsoft Dynamics NAV Classic.'), after the modifiction, I am now getting error 'You cannot use C/AL variables of type FORM when running the Application Server for Microsoft Dynamics NAV Classic.'.
I've looked at the entire codeunit 80 and all local functions and I cannot find any variables of type FORM, furthermore, I've remmed out all instances of all dialog windows that I can find, when I run this same routine on the foreground on my workstation, it posts the sales order successfully with absolutely no windows or forms popping up, can anyone give me a hint as to why I'm getting this error when running on the NAS?
I've looked at entire forum but cannot find an answer to my specific problem, which is the following:
I've created a codeunit that will post ship sales orders using the Navision Application Server, I have modified CU80 (Sales-Post) to supress all instances of any dialog windows from opening or updating (was getting error 'You cannot use C/AL variables of type DIALOG when running the Application Server for Microsoft Dynamics NAV Classic.'), after the modifiction, I am now getting error 'You cannot use C/AL variables of type FORM when running the Application Server for Microsoft Dynamics NAV Classic.'.
I've looked at the entire codeunit 80 and all local functions and I cannot find any variables of type FORM, furthermore, I've remmed out all instances of all dialog windows that I can find, when I run this same routine on the foreground on my workstation, it posts the sales order successfully with absolutely no windows or forms popping up, can anyone give me a hint as to why I'm getting this error when running on the NAS?
0
Comments
-
Are you working with lot or serial tracked items? The error is coming from the tracking logic on form 6510There are no bugs - only undocumented features.0
-
Yes, I'm working with item tracking items, but why does a form or dialog box not pop-up when I run this on a regular client? I ran the exact same routine and nothing (no errors or windows/messages) poped-up on my screen and posted correctly.0
-
The functions for handling item tracking are actaully on a form. Calling these form-based functions works just fine from a normal client. But try it from NAS (which can't run forms) and guess what happens.There are no bugs - only undocumented features.0
-
Thanks for the info, I guess there is no way then to run the posting routine (CU80) using the NAS for Lot tracked items....0
-
Well at least not without some customization work.There are no bugs - only undocumented features.0
-
Actually, i posted a sales document with item tracking from nas...i just have had to add "if guiallowed then" to any instance of "window" variable in codeunit 80, and also "dialog" in codeunit 22 (just to be sure).
:-k actually, i am not using the VERY STANDARD tracking module, but a modifed one...i'm wondering where did we do different... :-k0 -
Run the process manually with client monitor enabled and search for any Form in parameter no 14 (Source Object)0
-
I am on the same situation, I was getting the 'You cannot use C/AL variables of type DIALOG when running the Application Server for Microsoft Dynamics NAV Classic' error message when calling codeunit 80 running in NAS. I'm trying to modify codeunit 80 and add GUIALLOWED to any MESSAGE functions, but I did not find a single MESSAGE function in it. Instead I found ERROR functions that I know also generate dialog boxes. The thing is the ERROR function not just displays dialogs but also terminates the script. If I simply put the ERROR function in a GUIALLOWED block, then the script will continue when it should not:
IF GUIALLOWED THEN
ERROR(Text000);
So I guess I should simulate the behavior of the ERROR function but not show a dialog box. How do I achieve that?
IF GUIALLOWED THEN
MESSAGE(Text000)
ELSE
// <what to do here?>0 -
Not sure if this would work. Did you try with ERROR('')?0
-
you don't have to condition messages and errors...they do not stop the nas (actually, it's very dangerous to ignore the errors!).
You need to condition the "confirm" instructions and dialog type variables.0 -
rjsf wrote:I am on the same situation, I was getting the 'You cannot use C/AL variables of type DIALOG when running the Application Server for Microsoft Dynamics NAV Classic' error message when calling codeunit 80 running in NAS. I'm trying to modify codeunit 80 and add GUIALLOWED to any MESSAGE functions, but I did not find a single MESSAGE function in it. Instead I found ERROR functions that I know also generate dialog boxes. The thing is the ERROR function not just displays dialogs but also terminates the script. If I simply put the ERROR function in a GUIALLOWED block, then the script will continue when it should not:
IF GUIALLOWED THEN
ERROR(Text000);
So I guess I should simulate the behavior of the ERROR function but not show a dialog box. How do I achieve that?
IF GUIALLOWED THEN
MESSAGE(Text000)
ELSE
// <what to do here?>
Do You want to replace ERROR to MESSAGE? But's that big mistake... you can post broken data.
IF GUIALLOWED THEN
ERROR(Text000);
ELSE
BEGIN
SendToLogTable(Text000); //Your function, if you want to write error to some Log file
EXIT; //it's not right to continue
END;0 -
IF GUIALLOWED THEN
ERROR(Text000);
ELSE
BEGIN
SendToLogTable(Text000); //Your function, if you want to write error to some Log file
EXIT; //it's not right to continue
END;
Your code will exit and commit. There must be error to roll-back! If you want to log something - do something likeif not codeunit.run(rec) then begin LogError(GETLASTERRORTEXT); end;
0 -
//NO!!! DON'T WRITE THIS CODE!!! IF GUIALLOWED THEN ERROR(Text000); ELSE BEGIN SendToLogTable(Text000); //Your function, if you want to write error to some Log file EXIT; //it's not right to continue END; //NO!!! DON'T WRITE THIS CODE!!!
do not use the code suggested. It's very dangerous to replace errors with exits! If there are nested function:
- ERROR aborts the execution of the process and rolls back to the last commit
- EXIT exits the current function and the execution proceeds!!!!
if you want to do a "try-catch" like process, you have to wrap your errors in an IF codeunit.run then (search GETLASTERRORTEXT in this forum..you should find useful threads)
EDIT: ppavuk was faster, but i wrote my post with all my love and i didn't want to waste it0 -
My mistake, of course I mean what you say.0
-
We seem to have gotten of issue here. The problem is not the messages. It's because you can't run forms under NAS. Because they are using item tracking and the related functions are on a form (6510). The solution is to move those functions to a codeunit so NAS can use them.There are no bugs - only undocumented features.0
-
Yep, the item tracking is ugly and incompatible with NAS.
By to add another 2cents - messages and errors aren't problem for NAS. The dialogs and forms - are.
As far as I know messages will be just omitted, but errors will be logged to windows application log.0 -
Yep, double-checked, you are right.0
-
Guys,
I figured this is on topic so I'll post here.
I've gotten rid of all the message issues and am probably facing another one.
Recently the users are complaining that they get an error message when they are trying to post.
Something like "The ... cannot be changed because it is locked by another user".
So trying to isolate the cause I turned off the NAS and the problem went away.
So I believe my little NAS posting routine is locking the users out from doing their own posting.
Have any of you dealt with that issue before? Any suggestions?
Thanks0
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