I have created this trigger which will update my table (non-nav table) on insert.
However, it causing error on posting journal:
Item Ledger Entry already exists. Identification fields and values: Entry No.= '<Entry no>'
The trigger is basically reading the INSERTED table and update my non-nav table's quatity field or insert a record in the non-nav table.
Any help is greatly appreciated. Thanks in advance!
0
Comments
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Basically the code reads from inserted.
It first check in the non-nav table for any existing item no_, model code, etc. If exist, it will update the non-nav table. Quantity field is updated.
If the item detail cannot be found, the trigger will insert a record into the Non-nav table.
Script as follow:
What you should really do is make the thing that you are doing in the SQL Server trigger part of the posting routine in NAV, and use ADO or something like that. You could even create a linked NAV table based on the non-NAV table and treat it as a regular NAV table in C/AL code.
RIS Plus, LLC
I am able to update the external table with variables created from the inserted record with no problems, I just get the error when I try to use the inserted record or the variables as part of a select statement to get other data.
I know its been years... but has anyone found a work around for this? I really don't want to modify NAV code for this simple task.
As Denster wrote - do it in NAV. It is the best and safest way since what you are wanting to do is really a part of the overall transaction.
http://mibuso.com/blogs/davidmachanick/
In my opinion it's not true. Sift trigger works fine .
Never do it! Because there are no way to use same connection for Navision and Ado objects.
Nav, T-SQL.