Copy a globalvalue between forms

msmitsmsmits Member Posts: 9
It is simple to run a form (a list of orders), create a menu-button to open a second form with order lines (related to the OrderNo. from the first form). So, I’m not talking about a standard form and subform, but two separate forms.

But…

I know the Companyname in the first form, but I want to copy the Companyname to a global and place it on the second form in a Textfield. Is that possible and how can I do that?

Comments

  • DaveTDaveT Member Posts: 1,039
    Hi,

    This is the same solution as passing values to sub-forms - i.e. create a function in the second form which assigns the global value and call this function from the first form.
    e.g.

    Secondform.setglobal( par1,... );

    where Secondform is declared as a form

    Hope this helps
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • msmitsmsmits Member Posts: 9
    Hey,

    Thanks. But I'm still not able to use the global-value in the form:

    The function opens the orderline-form with the OrderNo-filter. If I want to select some lines to fill a textfield with the value of my global, the value remains empty, because it can only be used in the function.
  • DaveTDaveT Member Posts: 1,039
    Hi,

    This seems a different issue. The record filter is set before it will check the global variable. The solution for this is to create a record variable and filter this in the first form. Create the second form as a variable and use the command Secondform.settableview( Salesline ); You can still pass the variable as long as you are setting the variable to a gobal in the function of the second form.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
Sign In or Register to comment.