Newbie programmer wanting some help

I have just started programming in Navision Attain 3.60 and could do with a bit of help. I have created a new table which I want to update whenever a customer is added/changed. In the new table I have a function that I am calling from the OnInsert(), OnModify(), OnDelete() and OnRemove() of the Customer table. This is working fine. I also want to call this function from the “Detailed Cust. Ledg. Entry” table, so I can keep the up-to date Customer Balance (LCY) in my new table. None of the events OnInsert()… are fired when I post a sales journal, even though entries are written to “Detailed Cust. Ledg. Entry”. Can someone give me an idea what i’m doing wrong?

Isn’t there a flowfield of Customer balance in Customer table ?

There is FlowField which is fine for Customer inserts and updates, but I need to trap when a customers balance changes and record it in my new table, which is used to inform our sales system of these changes.

Hi You could make some changes in the posting codeunit. But I would avoid this. Another way could be to check the last journal entry after posting. There you can filter for Source Code = ‘Sales’ (Verkauf from German). If you got the last jounal entry you’ve got also the customer. You can try this with the following: Select Customer / Sales => Jounal => Customer Ledger Entry. bye André

Derek, Note that code that you place in the OnInsert or OnModify trigger of a table will only fire if the ‘Inserting’ or ‘Modifying’ object uses the TRUE parameter… i.e rec.INSERT(TRUE) not just rec.INSERT and rec.MODIFY(TRUE) not just rec.MODIFY In the example you give above I would hazzard a guess that the posting code for the sales journal line omits the true parameter from the insert of the new “Detailed Cust. Ledg. Entry” record. If you choose to change this I would advise you to be very careful in modifying such fundamental code. Regards, Chris.

My recomendation would be to create your own method in a new codeunit. Then, call this same code from the triggers (events) you have mentioned and also you can simply add a single line to the Gen. Journal Post Line codeunit to call your method. I do agree that wholesale changes to a posting routine are to be avoided! However, a simple call to another proceedure (that is documented) is very acceptable IMHO.

Thanks to everyone for their replies, and thanks to William I have a good idea for a solution.