Hi All,
I did some coding in OnModify trigger of a table. This code will trigger an ERROR message based on certain conditions. Funny thing is, I found out that ERROR called from OnModify trigger does not trigger roll-back if the changes were done on an external table.
For example...
1) Code is written in OnModify of ITEM table to issue error message if "Description" field is not filled
2) I have written code to update an external table, when "Inventory Posting Group" is specified in Item Card. This code is written in OnValidate trigger of Item Table of "Inventory Posting Group" field
3) I created an item card record, specified "Inventory Posting Group", but did not specify "Description"
4) ERROR message from OnModify check is triggered, the changes to "Inventory Posting Group" in Item table is rolled back. but the changes to external table maintains. This change was not rolled back.
Any one can help out?
0
Comments
RIS Plus, LLC
1) User create record (OnNewRecord etc. on form is triggered)
2) User enter value - OnValidate is called and when finishes, there is implicit commit=end of transaction...
3) After user leave the record or move to another etc. the OnInsert or OnModify is called and when finishes, there is implicit commit.
If you call Validate from code, it will be processed under one transaction with rest of your code, but when called from form by user data input, it is separate transaction...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Yes. then that would work. Actually, I have written some functions to make certain fields mandatory based on a setup table. And this code will call ERROR() from GLOBALINSERT and GLOBALMODIFY. This feature will apply to all tables in NAV.
So to make this work, I would then have to modify all validations from OnValidate to OnModify. Seems unrealistic. I guess, it will be back to drawing board.
Thanks anyway.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Yeah but you know that until they try it for themselves and after some months and a lot of user complaints they wont listen. ](*,)