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.
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.