Options

Making the execution of OnModify dependent from a variable ?

gazpachogazpacho Member Posts: 48
Hi

I defined the OnModify-trigger in a table. I want it to be run in normal daily use of Navision. But now I need a special action (from a separate codeunit) to be run once a month and is time-consuming. Problem is that I don't want the onmodify-trigger to be run when this specific action is run. Therefore I want to disable the OnModify-trigger, or make it variable dependent, when performing this specific action. Is there a way to use a sort of system-wide variable in order to determine from which object the call came (and so decide whether the onmodify must be run by a if-then statement) ?

Thanx

Gaz

Comments

  • Options
    bostjanlbostjanl Member Posts: 107
    gazpacho wrote:
    Hi

    I defined the OnModify-trigger in a table. I want it to be run in normal daily use of Navision. But now I need a special action (from a separate codeunit) to be run once a month and is time-consuming. Problem is that I don't want the onmodify-trigger to be run when this specific action is run. Therefore I want to disable the OnModify-trigger, or make it variable dependent, when performing this specific action. Is there a way to use a sort of system-wide variable in order to determine from which object the call came (and so decide whether the onmodify must be run by a if-then statement) ?

    Thanx

    Gaz

    Use Setup tables. Like table 98 -"General Ledger Setup" or 331 - "Sales & Receivables Setup". Add field to the tabel and use it in triger.

    BostjanL
  • Options
    DenSterDenSter Member Posts: 8,304
    There is no such thing to set up that will work system wide, without having to do extensive development. You can choose to run the OnModify trigger by calling it with a boolean [MODIFY(TRUE) will run the OnModify trigger, MODIFY(FALSE) will not, and FALSE is the default value].

    So, you could add a boolean type variable to your process and use it to run the trigger. For instance you could add a boolean var called 'RunIt' that you set depending on the relevant conditions. You could then program the modify statements in your process with that variable, like MODIFY(RunIt).

    HTH
Sign In or Register to comment.