triggers

can anyone tell me exactly and clearly in deatil so that i can be able to correcly write my code in the correct triggerin nav 2009 r2....with clear explanation?

Best Answer

Answers

  • SowkarthikaSowkarthika Member Posts: 102
    You can start with looking at https://msdn.microsoft.com/en-in/library/dd301068.aspx . Based on your requirement you can check similar objects in standard.
  • binilabrahambinilabraham Member Posts: 45
    Please check this link : https://msdn.microsoft.com/en-us/library/dd301068.aspx
    Hope this would help more than any other documents
    Software Developer,
    Archerpoint India Pvt. Ltd,Chennai.
  • shubhamshubham Member Posts: 9
    can anyone else tell otherthan this link which can clear my doubts about triggers ???
  • shubhamshubham Member Posts: 9
    i am not able to get it right when i am writing my code in the right triggers
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    explain your requirement and show us what and where did you write code..
  • shubhamshubham Member Posts: 9
    i am just asking in gerenral about the concept of triggers but please dont share the link
  • vaprogvaprog Member Posts: 1,140
    edited 2016-11-08
    A trigger is actually a misnomer. It is a callback function that is called by the system in case the corresponding event triggers it. So, for example, the OnInsert function in the Item table is called every time a record is inserted into the Item table. (In this case, if inserting a record through code, you have a choice of suppressing the trigger by calling the INSERT function without a TRUE as its parameter.)
  • TiwazTiwaz Member Posts: 98
    edited 2016-11-10
    First of all, you need to know that the difference between OnValidate and OnLookup for each field is that

    OnValidate gets triggered when you fill something in the field and hit ENTER or just click on another field.

    OnLookup is used to do something when you want your field to have lookup button on it (that button with tiny arrow, like when you choose something from drop-down list).

    Also, think about when you want your code to be executed and do you have suffincient information to execute it.
    For example, if you have fields X, Y, Z and W.
    And you want to calculate W = X + Y - Z.

    If you put code for this on OnValidate () trigger of Y (for example), it will be calculated when you fill the Y value and hit ENTER ONLY if NAV already knows values for X and Z (in other words if it's already filled).
    If they are not filled, NAV will assume that they are 0.
    If you enter a value in X afterwards, NAV will not calculate this again because it already took all the values and triggered the code on Y.
    If you want W to get calculated every time you change either X, Y or Z,
    you can:
    a) put W = X + Y - Z on OnValidate for X, Y and Z.
    b) put W = X + Y - Z only on Y trigger and then put the function VALIDATE(Y,Y) on OnValidate triggers of X and Z which will jump to Y OnValidate trigger every time you enter something in X or Z fields and execute W = X + Y - Z. :)

    Hope this gives you a basic picture of HOW and WHEN you use certain triggers.
    :)

Sign In or Register to comment.