Hi All,

I want to ask, is there some way, when I Insert/Modify record first to be Inserted/modified the record after that to be executed code in the OnInsert/OnМodify trigger.

In Navision Help for OnInsert/OnModify trigger is stated: “This trigger executes before the default insert/modify behavior is executed.”

I need this but in reverse order:

  1. Default insert/modify behavior is executed.
  2. INSERT/MODIFY trigger executes

I need this becouse I have code, in those triggers , wich should take in to acoount the New Record or the changes on the old Record

Thanks in Advance

It’s like it is, so no reverse order for you available.


I wonder if you have considerded using the Rec and xRec variables to achieve what you need to?

ex: I have filter in a OnInsert/OnModify, but new/modified record should go thought that filter :

SalesPrice.SETRANGE(“Item No.”,SpecialProducts.“No.”);

SalesPrice.SETRANGE(“Sales Type”,SalesPrice.“Sales Type” :: “All Customers”);

SalesPrice.SETFILTER(SalesPrice.“Starting Date”,’<=%1’,WORKDATE);

SalesPrice.SETFILTER(SalesPrice.“Ending Date”,’>=%1|%2’,WORKDATE,0D);

SalesPrice.SETRANGE(SalesPrice.“Price Includes VAT”,TRUE);


SpecialProducts.Price := SalesPrice.“Unit Price”.


If any change in Sales Price Table is made, that change should appear in the other table(if some condition are satisfied)

or maybe I should add this code in page Sales Price OnAfterGetRecord Trigger (in this trigger record is already inserted, right?), but I have read in forum that working with data in Pages/Forms is not recommended

Allen, what do you exactly want to achieve? So what is the functional requierment?

I have table Special Products (that products are Items) . Price for every item from Special Products is taken from Sales Price table. But for one item there are many records in Sales Price. So I should get price from record with last starting date, Price Including Vat=True…and that is ok I done that.

But when is added new record in Sales Price for that Item, and if that record has newer Starting Date than existing ones, than Price in Special Product Table (for that Item) should be updated(with Unit Price from new record

the same should happen if right record in Sales Price is modified.

You cannot change the triggers occurence, so forget about that :slight_smile:

One solution is:

  1. In Sales Price table, create a global variable and name it (for example) LatestPrice

  2. In Sales Price table, create a global function and name it (for example) UpdateSpecialProducts with a local variable like (receivedPrice) and then inside the function write:

LatestPrice := receivedPrice;

  1. On your Sales Price form, in OnValidate trigger of the field that your user inserts/modifys the sales price (or wherever that you think is suitable however after user enters the price), call the above function and pass the price (before calling this function you can also do whatever filters you have, to pass the right price) to Sales Price table

  2. In your OnInsert/OnModify triggers of your Sales Price table just use the LatestPrice (remove all those lines that you had to find the price) and update your SpecialProducts table with LatestPrice value