Hello,
VarRecord.modify();
When the change is submitted?
a) a submit is implicitly called after the modify
b) when leaving the trigger
c) modify submit the transaction
Could you please explain these issues to me?
I found in online help: "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."
I think that b) is the correct answer
Am I right?
--
Tom
0
Comments
I wrote a code in to try this.
The MESSAGE was first displayed, and after that the error message came, telling I was not allowed to change the customer database. This supports your theory.
New code :
With this example I first received the error message and not the other MESSAGE. So the modification will be submitted before the leaving the trigger or at least until next record command is being given. I changed the Item.GET command with Item.COUNT, and only the error message came. This supports my prevois theory.
B must be wrong. When you use modify I believe it is not an transaction, but a change. I would go for A.
I know if you use LOCKTABLE and not COMMIT, then the table is unlocked when it leaves the trigger.
BTW I have only worked with C/AL code and Navision for 2 1/2 month, som I'm not a pro, so maybee some seniors knows this better!
Colud you explain your answer to the question about transaction type?
Tom
When you use Navision Database Server, it maps to Snapshot and when you use SQL Server, it maps to Browse.
However in the Transaction Type description in Snapshopt paragraph it is said that
This is a read-only transaction. Modifications cannot occur within the transaction. All read operations are performed with SERIALIZABLE locking. Therefore, share-locks are placed and are maintained until the end of the transaction. This guarantees a consistent snapshot of the data read within the transaction.
Therefore I think that the option should be set as Snapshot but not Browse.
Tom