Hi,
I am running the codeunit from a form. In the codeunit I am using dialog window which updates on each record and finally closes.
The problem that happens is that whenever some error occurs(validation, data absence) during the execution of the codeunit error message comes, still the dialog remain open. It looks odd, and I want that whenever some error occurs, the dialog window should close without user intervention.
Thanks in advance
0
Comments
If your codeunit has an error, the transaction is undone, but all the variables in the codeunit remain active until you do a CLEAR.
If you run the codeunit with CODEUNIT.RUN, this should not happen because the instance of the codeunit is cleared.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Its so simple..
when you call codeunit from the form dont create a variable of a codeunit.
just write this way.
use following syntax :
when error comes dialog box automatically closed.
Regards,
Rajesh Patel
sorry that i post in this "old" thread but i've the same problem.
the answer of rajpatelbca is correct but i've two problems with that:
1) why occurs this error (!)?
2) how can i use functions of a codeunit in this case?
kind regards,
Matthias
EDIT:
aahhh the scope is the problem......do not use globals
SOLVED
Yes, the scope is the problem here, because if the variable is still valid, the dialog will not close. If it is in something what is not valid anymore after error, the dialog is disposed automatically...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Points in my book for actually searching for a solution before posting your problem. =D>
My Blog - nav.education
RIS Plus, LLC
MVP - Business Apps
i've had the same problem a pair of years ago, but i left it unsolved because the problematic object wasn't developed by me...good to know, thanks for pointing this out :thumbsup:
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog