On Insert-query

I need to update a field in a table(G/L budget entry) when i post a purchase order.So,i have written the code on ON INSERT trigger of purchase line.

The field has to update once the purchase order is posted,but it is only updating after posting the second purchase order.(With same filters) with the values given on the first PO.

Any reason?

Hi,

You need to edit the posting routine (Codeunit 90 / 92) for this purpose and as you don’t understand posting routing, better don’t play with them.

Don’t give such instant solution to your customer, you will create DISASTER …(this is as per your last post) [:(]

How are OnInsert and Posting of PO related? How can you expect your code to update the field on posting when you have written code OnInsert trigger?

I have read from HELP that the code on On Insert gets executed when a user inserts new record in to that table.

That is why i have written that …i think i should write it on purchase invoice line table?

Any suggestions?

aravind,

You now have 3 or 4 topics open on this one Issue, it looks like you are being asked to do work that is beyond your skill set, you should put the changes on hold until you have the right knowlege, some extra training or some help on the project.

What you are trying to do can be done mostly with the standard system, see my post on your other topic, the G/L Account has Budget and Actuals fields which you can calculate on posting to check, try to use what is already there and not add fields and code that is not required.

Before starting any modules ask for advice on the best approach, if you do not have these skills in-house then you may need to contract out some of the harder requirements, rather than having a go yourself which can give your customer cause for concern.

When the Insert is actioned (only once) there may only be the Key Fields populated, “Document Type”, “Document No.” and “Line No.”, so that is not the place for your update.

David