Trigger OnModify() Sales header/Sales Order

hazem
hazem Member Posts: 187
Hello,
I want to add some code into the trigger OnModify() of the table "Sales header". But i want this code to be executed only if the modification was done on the form "Sales Order" related to this table. How to do this?

Answers

  • kriki
    kriki Member, Moderator Posts: 9,132
    You can use this test [but it will also be triggered if you save records with MODIFY(TRUE) ]:
    IF "Document Type"="Document Type"::Order THEN BEGIN
       ....
    END;
    

    Or if this is not good enough, you can create a new function in the table:
    Function IAmInTheSalesOrder()
    BEGIN
      blnIAmInTheSalesOrder := TRUE;
    END;
    

    And test on this:
    IF blnIAmInTheSalesOrder THEN BEGIN
       ....
    END;
    

    The function must be called in OnModifyRecord-trigger of the form.
    IAmInTheSalesOrder();
    EXIT(TRUE);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • hazem
    hazem Member Posts: 187
    Thanks kriki, i put the code into the trigger OnModifyRecord() of the form and that works perfectly