Skip to main content

Notifications

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.

  • Suggested answer
    ergun sahin Profile Picture
    8,816 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.

  • 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

  • ergun sahin Profile Picture
    8,816 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

    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

  • Suggested answer
    ergun sahin Profile Picture
    8,816 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.

  • Suggested answer
    Martin Dráb Profile Picture
    232,866 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());

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,095 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans