wher should i put the code!

phondajphondaj Member Posts: 60
I want to show a message box when user try to save or close the window, where i should i put my code!

thnx!

Comments

  • garakgarak Member Posts: 3,263
    take a look on trigger

    Form - OnQueryCloseForm() : Boolean
    Do you make it right, it works too!
  • phondajphondaj Member Posts: 60
    garak wrote:
    take a look on trigger

    Form - OnQueryCloseForm() : Boolean

    i try this way but i want when users try to "save" using to close the form or next botton for item that is is mising something a want to show tu user that mesagebo end do not leav to save until all they enter all data
  • MBergerMBerger Member Posts: 413
    Remember that there is no single moment when NAV saves a record. As soon as you leave a field, it is saved, as supposed to other programs where you manually have to save a record or the whole thing gets saved when leaving a record. there is one exception though : Inserting a record on a form that has the "DelayedInsert" property on.
  • phondajphondaj Member Posts: 60
    my problem is that i dont wat user to stop creating items if any necessary data is missing
  • MBergerMBerger Member Posts: 413
    phondaj wrote:
    my problem is that i dont wat user to stop creating items if any necessary data is missing
    what you could try in that case is setting the item card to "DelayedInsert" and code your checks in the OnInsertRecord trigger of the form. Problem with this is that 1) you have to do it for EVERY form where you can add an item ( if there are any ), and 2) you are going down a dangerous road....once you do this, your client might want the same for other entities, and you wil end up altering everything in NAV.
    This is just not the way NAV works, it's too open for that.
  • ssinglassingla Member Posts: 2,973
    The option I use with Master cards is that I make them blocked on insert record. Then on validate trigger of "Blocked" a function is called to check whether the required fields has been filled.
    CA Sandeep Singla
    http://ssdynamics.co.in
  • kinekine Member Posts: 12,562
    ssingla wrote:
    The option I use with Master cards is that I make them blocked on insert record. Then on validate trigger of "Blocked" a function is called to check whether the required fields has been filled.

    I am recommending this way too... There is nothing like "moment when user try to save record". There are moments when user "needs to change value in this or this... field" etc.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.