Form.RunModal() is not allowed in write transactions.

imurphy
Member Posts: 308
Using Nav 5.0sp1.
I have a small data port I am using for testing. I use it to import a text file containing an order... which I have been using for days.
All of a sudden I start getting this error when I import the file...
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.
Now at first I was mystified as to what the problem was, but then I stepped through the debugger and hit on the following lines as being the culprit:
Form 343 - Check credit limit
CalcOverDurBalanceLCY()
CALCFIELDS ("Balance Due (LCY)");
Aha! so the client I'm using has gone over their credit limit.... but shouldn't this have generated an error.. I mean an error message from the form or something which a normal human being can deal with?
Anyone know how I can debug this? How can I catch it?
Ideally my dataport should be able to run and generate reasonable errors when things don't work... if one of the no-no functions is being used within the calcfields triggers of 'Balance Due (LCY)' then it would seem to me that this is a bug, no?
Ian
I have a small data port I am using for testing. I use it to import a text file containing an order... which I have been using for days.
All of a sudden I start getting this error when I import the file...
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.
Now at first I was mystified as to what the problem was, but then I stepped through the debugger and hit on the following lines as being the culprit:
Form 343 - Check credit limit
CalcOverDurBalanceLCY()
CALCFIELDS ("Balance Due (LCY)");
Aha! so the client I'm using has gone over their credit limit.... but shouldn't this have generated an error.. I mean an error message from the form or something which a normal human being can deal with?
Anyone know how I can debug this? How can I catch it?
Ideally my dataport should be able to run and generate reasonable errors when things don't work... if one of the no-no functions is being used within the calcfields triggers of 'Balance Due (LCY)' then it would seem to me that this is a bug, no?
Ian
0
Comments
-
This is not a bug. A bug is when software does not work as intended. Just because it does not work the way you think it should does not make it a bug.There are no bugs - only undocumented features.0
-
this is not a bug. During a transaction, it's not allowed to open a object with rundmodal. Because runmodal stops the transaction an wait for the user interaction. So, all ather users are blocked (who need the table) until the user close the form.Do you make it right, it works too!0
-
on sales header and sales line, there is a function called
setHidevalidationdialog or something similar
You need to call the function first and set it to true.0 -
Thanks ara3n, wasn't aware such a function existed. I'll have to give it a go and see what effect it has.
garak/bbrown,
By bug I meant that the dataport should be able to function from a button - if the user clicks on the button but is faced by an error saying that they can't run code because x, y or z but does not mention the cause then this would be unexpected behaviour since generating the same order manually *would* generate an alert dialog.
Unexpected and unreasonable behaviour is normally be caused by a bug.0 -
"Unexpected and unreasonable behaviour" by whose definition? Yours or the designer/developer?There are no bugs - only undocumented features.0
-
Ask a user0
-
imurphy wrote:Ask a user
It's not about how a user thinks the system should work. It's about how the designer intended it to work. If the system does not work how the designer intended, that's a bug. If it works as intended but not how the user wants it to work, that's a difference of opinion. Making it work the way the user wants it is called customization.There are no bugs - only undocumented features.0 -
imurphy wrote:By bug I meant that the dataport should be able to function from a button - if the user clicks on the button but is faced by an error saying that they can't run code because x, y or z but does not mention the cause then this would be unexpected behaviour since generating the same order manually *would* generate an alert dialog.
Unexpected and unreasonable behaviour is normally be caused by a bug.
This error is telling you what is wrong, it tells you how you can solve the problem too ("... or structure the code differently"). That something is working when done manually doesn't necessarily mean that it will work when done in code. Do not forget that each user input is isolated transaction, but when running code, all is one big transaction. It is why the error is not there in user input (there is no write transaction before the form is opened), but it is in your process (you already started to write into the database).0
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