Intercept the page of origin

sharon95sharon95 Member Posts: 183
Hi all! My aim is to intercept the page of origin in which data will be collected in a table... not clear? I know! :D Example: I have the table MyTable with some code in one trigger, I want to execute the code only if it is accessed by the page FisrtPage (and not for the all other pages)... is it possible? and if it is, how? Thank you very much!

Best Answer

Answers

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Firstpage is name of the page or page which executes above code first?
  • sharon95sharon95 Member Posts: 183
    Firstpage is name of the page or page which executes above code first?

    Firstpage is the page from which the code in the table is executed
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    why cant you simply create a function in table and call it from page field OnValidate trigger?
  • sharon95sharon95 Member Posts: 183
    why cant you simply create a function in table and call it from page field OnValidate trigger?

    mmhh.. I don't have to execute the code into the table's OnValidate trigger only if it is accessed from a specific page..
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    sharon95 wrote: »
    mmhh.. I don't have to execute the code into the table's OnValidate trigger only if it is accessed from a specific page..
    I didn't get your point.
  • sharon95sharon95 Member Posts: 183
    sharon95 wrote: »
    mmhh.. I don't have to execute the code into the table's OnValidate trigger only if it is accessed from a specific page..
    I didn't get your point.

    My table is accessed from many pages (page1, page2, page3, ....).
    If I am in page1 I have to execute the table's Onvalidate trigger.
    If I am in page2 I have to skip that trigger

    Is it clearer?
  • sharon95sharon95 Member Posts: 183
    yes, you can write code in page 1 onvalidate trigger of field and no need to write in table. Did you try?

    I will try, thank you!
  • zaidtariqzaidtariq Member Posts: 52
    edited 2017-01-24
    Suppose you are inserting data from the Page One, then use like TableRec.Validate(field,NewValue) and if inserting from the other pages do not call the Validate, then it will simple do like field := NewValue.
    OR you may try to write code in OnValidate() page trigger.
    Best Regards:
    Zaid Tariq
    Dynamics NAV/365 BC Developer at Dynamics 360

    please like / agree / verify my answer, if was helpful.
  • lubostlubost Member Posts: 628
    Hi,

    table OnValidate trigger should be preferable used to ensure database integrity. If your code is to be run only in some cases, it should be separated by IF statement in table OnValidate trigger, or placed in separate function that can be called when needed without interference with validation code.
  • krikikriki Member, Moderator Posts: 9,115
    [Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.