We are trying to create a procedure that will undo a shipment and automatically post a corrected shipment.
We are using standard Navision functionality by calling procedure that calls the following CU:
CU: Undo Sales Shipment Line &
CU: Sales Post
The problem is when somebody else is using Sales Line table (table locking?) the Sales Post part of routine fails and the error is displayed and rollback is performed to the pre Sales Post state - meaning: our transaction was rolled back to the point after Undo Sales Shipment Line, not to the initial state.
Is there a way to control the transaction from start to end, and if something goes wrong we can return to our initial state (not the state on beginning of some trigger!).
As far as we know, COMMIT is performed on end of every trigger and if our function has more then one trigger then the rollback is performed to the state that was on beginning of current trigger.
Does that mean that our undo functionality (including functionality used from CU: Undo Sales Shipment Line & CU: Sales Post ) has to be in ONLY ONE trigger???
Better to be critical then self-critical
0
Answers
I think that in C80 somewhere a COMMIT is hidden. Check out the codeunit for COMMIT's there are a few in it that can be a real pain-in-the-ass for this kind of things.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
So we should try to remove those COMMIT's?
What are the possible problems if we do that?
I thought that COMMIT is performed at the end of every trigger :?:
A common misconception, maybe because it is not explained well enough in the manuals/courses.
Possible performance issues because the transaction becomes longer in case of a normal posting.
So better to make a new function in C80 to say that the commits should not be used. And just before calling the codeunit, call that function. I give some idea how to do it.
In codeunit 80:
And all COMMIT's must be changed by this code:
Code for calling C80:
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
We solved it like kriki sad!
Just to mention, there was another COMMIT in Update Analysis View (CU 410) that needs to be taken care of 8)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.