Hi
When using automation variables in NAV, it's sometimes quite hard or even impossible to avoid errors.
For example xmlHttp.send: If the endpoint is not available, an error occurs.
Sometimes it's possible to pack the critial code in a kind of wrapper codeunit and call this codeunit with "if codeunit.run". If the result is false, we can then handle the error or at least stop the current code execution in grace. But this approach is not possible if a transaction has already begun.
Do you have made same experience, or even better have a solution for that? I guess, one solution would be to program a wrapper class in c# or vb.net that sends back a status to NAV instead of raising an error.
May thanks in advance
Thomas
0
Comments
My Blog - nav.education
Thanks a lot. What do you mean with "have your functions return booleans"? Can you show some sample code? My problem is, that I cant avoid the automation object to throw an error. :?
Thanks in advance
Thomas
NAV:
My Blog - nav.education
Thanks
Thomas
My Blog - nav.education
Thanks Mattrax, this was also my initial input. I was searching for a solution without visual studio.
Regards
Thomas
RIS Plus, LLC
MVP - Business Apps
Thomas
RIS Plus, LLC
MVP - Business Apps
The following C/AL functions can be used only to a limited degree during write transactions (because one or more tables will be locked).
Form.RunModal() is not allowed in write transactions.
CodeUnit.Run() is allowed in write transactions only if the return value is not used. For example, 'OK := CodeUnit.Run()' is not allowed.
Report.RunModal() is allowed in write transactions only if 'RequestForm = FALSE'. For example, 'Report.RunModal(...,FALSE)' is allowed.
DataPort.RunModal() is allowed in write transactions only if 'RequestForm = FALSE'. For example, 'DataPort.RunModal(...,FALSE)' is allowed.
Use the COMMIT function to save the changes before this call, or structure the code differently.
RIS Plus, LLC
MVP - Business Apps
My Blog - nav.education
Simply stating that you should NOT use it is not very helpful :-k
RIS Plus, LLC
MVP - Business Apps
My Blog - nav.education
Any other input concerning the error handling?
Many thanks
Thomas