Standard NAV Previous & Next buttons

poppinspoppins Member Posts: 647
Hi everyone,

We have the buttons Next & Previous in NAV pages.
I have a customization to make in a page: If I click on Next, a certain code has to be executed, and if I click Previous, a different code should be executed.
As far as I know, the trigger in the code is the same for both buttons: OnNextRecord.
If I am going to place my code there, how can I make the difference between the two?

Thanks in advance :)

Comments

  • Purvesh_MaisuriaPurvesh_Maisuria Member Posts: 71
    Hi poppins,

    Page have this trigger : "OnNextRecord(Steps : Integer) : Integer"

    In this trigger, Steps is a integer argument, it is give the -1 when you press previous button and +1 when you press Next button.

    Thanks,
    Purvesh Maisuria.
  • kinekine Member Posts: 12,562
    Please, do not do that. Go next/previous are not NAV triggers. In general, movement between records are not events you can catch/react on them. It is not a NAV way of working.

    And using OnNextRecord will totally mess the app if you do not know what you are doing. because overloading these triggers means that the standard behaviour will not work...

    Rather describe the business case you need to solve and try to find the standard way of solving the reason for this requirement.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • vaprogvaprog Member Posts: 1,140
    edited 2015-10-22
    I don't see any problem using this trigger. You just need to know that you cut off the standard functionality, which you neet to emulate. Your code needs to do the equivalence of
    EXIT(NEXT(Steps));
    
    Take into consideration, though, that this trigger is not tied to those buttons, but generally to retrieving records for display. It is used on open, refresh, scrolling, ...

    So most likely, this is not the proper approach. For this reason I join in with kine
    kine wrote: »
    Rather describe the business case you need to solve and try to find the standard way of solving the reason for this requirement.
  • poppinspoppins Member Posts: 647
    kine wrote: »
    Please, do not do that. Go next/previous are not NAV triggers. In general, movement between records are not events you can catch/react on them. It is not a NAV way of working.

    And using OnNextRecord will totally mess the app if you do not know what you are doing. because overloading these triggers means that the standard behaviour will not work...

    Rather describe the business case you need to solve and try to find the standard way of solving the reason for this requirement.
    vaprog wrote: »
    So most likely, this is not the proper approach. For this reason I join in with kine

    Hi,
    Thanks for your answer...
    I created a custom page with type Card.The page is reading records from a buffer table.
    What I need to do is that when I click Previous, I only display the previous record, but when I click Next, I need to insert the content of the buffer table for that record into another table.And when I am in the last record and I click Next, I need to open another page(to do some checks and controls).
    That is my requirement...

  • pjotresztickpjotresztick Member Posts: 8
    What business problem will be solved by this requirement? This way of working is very unlike the way NAV handles things and therefore, in my opinion, not the preferred way of solving the business problem.

    Developing this requirement will most probably confuse the users of the system, because this page will be working in a different way than all other pages.

    I think the best way of customizing NAV is following the way the standard application works.

    Is it not possible to add the records in the other table by using an action?
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    He is apparently trying to code some sort of wizard. Just a wild guess
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • joshuasungjoshuasung Member Posts: 37
    If we know whole requirements, that might be better approach.

    However, if you have to accomplished that, I suggest make custom NEXT and PREVIOUS button and play with that logic.
    Later, much easier to add another lay of function if you have to.
    Joshua H Sung

    Sr. Project Manager
    S-Metric, LLC
    jsung@smetric.com
Sign In or Register to comment.