Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

Open form on button click

Posted on by 10

I need to open the form on button click
and inside clicked method i kept this code

Args args;
FormRun formRun;


Args = new Args(formStr(HcmGoalAddFromTemplate));

formRun = New FormRun(Args);
formRun.init();
formRun.run();
formRun.wait();

formname  -------->  HcmGoalAddFromTemplate

and I also tried using menuitem button with the same formname

always getting the same error as Object reference not set to an instance of an object.

  • _Charan Profile Picture
    _Charan 10 on at
    RE: Open form on button click

    ok got it thank you :)

  • Suggested answer
    Komi Siabi Profile Picture
    Komi Siabi 12,407 Super User on at
    RE: Open form on button click

    Hi _Charan,

    Just like Ferhat, suggested build the solution and your custom module from the Extension -> Dynamics 365

  • Verified answer
    Ferhat.S Profile Picture
    Ferhat.S 231 on at
    RE: Open form on button click

    Hey Charan

    I tested your code and its working. You might be clean solution and rebuild it.

    Code probably not seeing your form.

    Also please use Insert>Code paste your code here it makes easy to read.

    Like:

    Args args;
    FormRun formRun;
    
    
    Args = new Args(formStr(HcmGoalAddFromTemplate));
    
    formRun = New FormRun(Args);
    formRun.init();
    formRun.run();
    formRun.wait();

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,459 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,783 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans