IF CODEUNIT.RUN THEN ...
nromain
Member Posts: 57
Hello,
To plug some linked treatments in job queue with no error message, i have create a codeunit that run an other codeunit such like this :
Codeunit 50000 (called by jobQueueEntry."parameter string" = 1)
My problem is that i receive an error message during the second run of the codeunit 50001 :
The following C/AL can be used only at a limited degree ... Use the COMMIT function ...
I first thought it comes from my var JobQueueEntry which i modified just before the codeunit.run but even if i don't modify it i still receive the error...
I have tried many different ways to do this (using var codeunit instead of codeunt.run, using temp var for modified jobQueueEntry,...) but still the error..
Could you help me please? it seems i can't do 2 "IF CODEUNIT.RUN THEN" in the same function...
Thanks
Nicolas
To plug some linked treatments in job queue with no error message, i have create a codeunit that run an other codeunit such like this :
Codeunit 50000 (called by jobQueueEntry."parameter string" = 1)
IF CODEUNIT.RUN(50001,JobQueueEntry) THEN BEGIN
FctWriteSuccessLog();
JobQueueEntry."parameter string" := 2;
IF CODEUNIT.RUN(50001,JobQueueEntry) THEN //error
FctWriteSuccessLog()
ELSE
FctWriteErrorLog();
END ELSE
FctWriteErrorLog();
My problem is that i receive an error message during the second run of the codeunit 50001 :
The following C/AL can be used only at a limited degree ... Use the COMMIT function ...
I first thought it comes from my var JobQueueEntry which i modified just before the codeunit.run but even if i don't modify it i still receive the error...
I have tried many different ways to do this (using var codeunit instead of codeunt.run, using temp var for modified jobQueueEntry,...) but still the error..
Could you help me please? it seems i can't do 2 "IF CODEUNIT.RUN THEN" in the same function...
Thanks
Nicolas
0
Answers
-
before the lines with IF CODEUNIT.RUN add COMMIT;0
-
Thanks, it works
but i don't understand why? what is the record that needs COMMIT?
Nicolas0 -
When the system enters a C/AL codeunit, it automatically enables write transactions to be performed. When the system exits a C/AL code module, it automatically ends the write transaction by committing the updates made by the C/AL code.
This means that if you want the C/AL codeunit to perform a single write transaction, the system automatically handles it for you. However, if you want the C/AL codeunit to perform multiple write transactions, you must use the COMMIT function to end one write transaction before you can start the next. The COMMIT function separates write transactions in a C/AL code module.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
- 323 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