Simulate the event Click on Ok button on a Modal Form

MCalciniMCalcini Member Posts: 9
Hello
i have a problem with a modal form. I wont to open a custom "item variant list" on-open form trigger standard Form.
I have to do this because we want to work always on the custom form, and we wont to modify the standard form when Microsoft release one new version of Nav.
In a Card Form on the Open Form trigger we run the custom form and when the user close the curtom form C/side code return to On Open trigger of the standard Form and with CurrReport.CLOSE we close the standard form.

When we use a custom list form to select a record or a record field i must simulate the OK event click on the standard form if on custom modal form the user press OK.

If we have an idea to simulate the event click on ok button on a modal form... [-o<

Thanks for the attention

Comments

  • David_SingletonDavid_Singleton Member Posts: 5,479
    can you call the form with

    IF MyForm.Runmodal = action::lookupok then ....
    David Singleton
  • DaveTDaveT Member Posts: 1,039
    Hi MCalcini,

    If I understand you correctly - you have developed a custom item list which you want to use always. If it is the case that you always want this form on lookup of an item throughout the system then I suggest you change the LookupFormID (and DrillDownFormID) in the item table.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • MCalciniMCalcini Member Posts: 9
    Thanks David Singleton but it's not that i need.
    Perhaps I'm explained badly.

    Example in the form of Sales Order the user select the variant code of an Item by the lookup. Standard Item Variant List (Form 5401) start... in the Open Form Trigger we open the Alternative Item Variant List Form.

    IF FORM.RUNMODAL(InvSetup."Alternative Item Variant List",Rec) = ACTION::LookupOK THEN BEGIN
    LookupMode := CurrForm.LOOKUPMODE;
    END ELSE
    CurrForm.CLOSE;

    If the user select ok in the Alternative item Variant list the custom form it's closed and retrive ACTION::LookupOK (therefore we are in "THEN" statement).
    Now we need to close the standard form...but if I do CurrForm.Close the selected record are lost.
    I must simulate the event click on OK button because there isn't a statement CurrForm.OK.
  • DaveTDaveT Member Posts: 1,039
    Hi MCalcini,

    I think I've got it now #-o

    You want the user to use your custom form and if ok return the record and if not then use the standard list.

    The way I would approach this is to put the code in the onlookup trigger in the sales order form.

    Alternatively if you are going to call this system wide then try to code getting the record (in the standard form) to set the current record so it can return it

    Try rec.get(...) or currform.setselectionfilter

    Again if I have got this wrong and you only need your customer item variant list then put it in the LookupformID in table 5401

    Hope this helps :wink:
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • MCalciniMCalcini Member Posts: 9
    Thanks DaveT for the first message...
    If i do what you have said it means that we modify all the form that call the form 5401. Instead if we call the custom form in the "on open form" of the Item Variant List standard Form, all the point that call it will work correctly. And when microsoft release a new version of Navision we only import our object and modify only "on open form" of the standard form.
    That it work well for the Card Form....but for the List Form used for select a record or a record field I have the problem for execute the click button of the standard form if the custom form ACTION is LookupOK.
    ...now i read your second idea
Sign In or Register to comment.