Hi everyone !
I came across a scenario, where I have to pick up the error message that comes because of validating any field. As I am using NAS , and NAS does not support GUI, I cannot pick up the display message just like that. Say , on validating a wrong data to Product Group Code of the Item table, the error comes up some thing like this :-
'Product Group Code 'T' does not exist' (where T= data that was fed into the Item category code field). Can anyone tell me , how can I pick this error message ?
Subhasish Chakraborty,
Systems Analyst,
MBS Dynamics.
0
Comments
There's no way to catch errors, NAV does not have an error object. You will have to program your functionality to check for errors before validating fields, so you can program around them. In 5.0 there's a LASTERRORMESSAGE method or something like that, which you can use for this.
What I've done in the past is to program all field validation in a codeunit, and call the codeunit in an IF statement. Inside the codeunit I would keep track of which field I was validating, so if that errored out I could fish the message out of the codeunit. This would still not be the actual error message, but still you'd know what was going on and you can log it into an error log table.
RIS Plus, LLC
the method that you asked to use is : 'GETLASTERRORTEXT' which returns a string type variable. I tapped it and moulded it as an XML . It worked !!!
Systems Analyst,
MBS Dynamics.
I have written at the on validate event of Department :-
But the code stops at that point of time only, if some wrong department value is nenetered .It wont look at the next lines of code. So the Error message contains a null value !
Please suggest me , how to come around this .
Systems Analyst,
MBS Dynamics.