web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

MenuItem, Class, Dialog, form pass Parameters

(0) ShareShare
ReportReport
Posted on by 109

Hello,

I have 2 menu Items, a menu item has a parameter, another one have not.

pastedimage1617565895738v2.png

I can read the parameter in Main method inside Class

pastedimage1617566081844v3.png

However, although my variable is in the same class and defined in ClassDeclaration, the value in the dialog method is empty.

pastedimage1617566292422v4.png

Dialog method opens another form, I want to make operations on the form according to the selected menuit, but I could not move the parameter on the menu item to the form.

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    236,394 Most Valuable Professional on at
    RE: MenuItem, Class, Dialog, form pass Parameters

    Do you have any code to populate the instance variable (the variable defined in ClassDeclaration)?

    Your code in main() assign the value to a local variable, but it isn't used anywhere and therefore the value disappears at the end of main() without having any effect on your program.

    If args is already passed to the class, take the value from there inside an instance. It it's not, create a parm method and call it from main() to set the value.

    ledgerBalanceSheetDimP.parmMelioParmAuto(args.parm());

  • Suggested answer
    ergun sahin Profile Picture
    8,824 Moderator on at
    RE: MenuItem, Class, Dialog, form pass Parameters

    Technically, the main method is static. You cannot use global variables inside static methods.

    Now you have two different variables with the same names. If you want to use global value, you need to fill it with parm methods.

  • Faruk Durak Profile Picture
    109 on at
    RE: MenuItem, Class, Dialog, form pass Parameters

    Hi Martin and Ergün,

    Thank you for interest.

    I have the variable in ClassDeleration

    pastedimage1617611820690v4.png

    Also I added parm method

    pastedimage1617611868217v5.png

    I first call my menu item, the menu item has a parameter.

    pastedimage1617611557759v1.png

    I call the parm method in the Main. My variable is loaded


    pastedimage1617611612564v2.png

    I can't see the parameter in same class in init method.

    pastedimage1617611708531v3.png

    also I can't see the variable in Form init method

    pastedimage1617612711927v6.png

    actually I need the variable on the menu item on the form. I'm trying to move the forum over the class because it opens a class. Could there be a different method?

    I can see the parameter value in main method, If I can see other method my problem will be solved

  • ergun sahin Profile Picture
    8,824 Moderator on at
    RE: MenuItem, Class, Dialog, form pass Parameters

    How did you call the form in the class. (The last two pictures you posted are the same, I think the pictures are mixed)

  • Faruk Durak Profile Picture
    109 on at
    RE: MenuItem, Class, Dialog, form pass Parameters

    I call with my new menu item with parameter.

    pastedimage1617617266596v1.png

  • Suggested answer
    ergun sahin Profile Picture
    8,824 Moderator on at
    RE: MenuItem, Class, Dialog, form pass Parameters

    It fills and sends args in the class's dialog method. You are probably filling the parm (meiloParmAuto) after args is filled. It's not that important, you can directly add parm to args and send the value.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,004

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 857 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 548 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans