Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Lookup for a Dialog field in Dialog

Posted on by 2,420

Good Morning,

I am trying to write Dialog in one of the Customized Button -->clicked()

Ex - void clicked()

{


Dialog dialog = new Dialog("Email");


DialogField custaccount,cust,vend;

custaccount = dialog.addField(extendedTypeStr(CustAccount ), 'Cust Account :' );

cust = dialog.addField(extendedTypeStr(NoYesId ), 'Customer :' );
vend = dialog.addField(extendedTypeStr(NoYesId ), 'Vend :' );

if(dialog.run())
{
info("Working");

}

}

I have created one job for trial

Enable.png

If i click Customer.get the lookup of CustAccount.

if i click Vend .get the lookup of VendAccount.

Is it possible.

can i write in clicked Method(Above Clicked()).

Please guide me.

Regards.

Any help would be greatly appreciated.

Thanks.

Have a great day.

*This post is locked for comments

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Lookup for a Dialog field in Dialog

    Hi AX 2012 r3,

    It looks for me a bit wrong.

    1) Be specific in class names. "Dialog lookup" is too general and does not reflect purpose of this class.

    2) You can use "description" method to set caption, please refer to tutorial_RunBaseBatch class.

    3) Why do you need to override lookup if you have 2 controls ? You have it out of the box. When I suggested lookup override I was thinking about lookup that shows vendors or customers depending on radio button, but 2 controls maybe a solution as well.

    4) You completely missing pack, unpack and variables in class declaration, please refer to tutorial_RunBaseBatch class.

    5) I don't understand what are you trying to do with "i" and "j", code should look like:

    if (dialognew.value() ==  Persn::Customer)
    {
        ...
    }
    else
    {
        ...
    }


  • AX 2012 r3 Profile Picture
    AX 2012 r3 2,420 on at
    RE: Lookup for a Dialog field in Dialog

    Hi Ievgen,

    I have created a new class

    But when i change in radio button.the dot is styaing in first element.it is not selecting if i select vendor.

    If i made change The look up is coming.

    Please find the below screen shots and please rectify it

    enum10.png

    Enum2.png

    Enum3.png

    enum5.png

    enum6.png

    enum7.png

    enum8.png

    enum10.png

    enum12.png

    I am getting Vendor..But the Dot is not changing to vendor.

    I have done somewhere wrong.

    Please correct it.

    Thanks.

    Have a great day Ievgen.

  • AX 2012 r3 Profile Picture
    AX 2012 r3 2,420 on at
    RE: Lookup for a Dialog field in Dialog

    Hi Martin,

    Hope you are fine.

    Yes i have seen.But i dont have in depth knowledge regarding RunBase and Sysoperation Dialog.

    Yes i am Fresher.I have completed 10 months in Microsoft Dynamics AX.

    Mostly i have worked on reports.

    I am trying Ievgen Solution.

    Thank you so much Martin.

    Regards.

  • Martin Dráb Profile Picture
    Martin Dráb 229,297 Most Valuable Professional on at
    RE: Lookup for a Dialog field in Dialog

    Yes, of course RunBase can do it - you've never see any? You call the class by a menu item button, it shows a dialog on client and then switch to server and execute your business logic there.

    Nevertheless AX 2012 has a new framework for this - SysOperation. It will do a lot of things for you, so you don't have to write as much code as with RunBase. Create a data contract class for your three fields, then create a custom UI building class (extending from SysOperationAutomaticUIBuilder, which will generate the dialog for you), implement your lookup method and use registerOverrideMethod() to tell a dialog field to use your method instead. Then associate your UI builder with your contract through SysOperationContractProcessingAttribute,. I'm sure you'll find a plenty of examples, now when you know a few keywords.

  • AX 2012 r3 Profile Picture
    AX 2012 r3 2,420 on at
    RE: Lookup for a Dialog field in Dialog

    Hi Ievgen,

    Hope you are fine,

    the requirement is if we click that button.this dialog should appear.

    Can i meet this if i create a run base class.?

    please guide me.

    Regards.

    Have a great day ievgen.

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Lookup for a Dialog field in Dialog

    Why you don't want to create proper run base class ?

  • AX 2012 r3 Profile Picture
    AX 2012 r3 2,420 on at
    RE: Lookup for a Dialog field in Dialog

    Hi Ievgen,

    Yes you are right .It should be a radio button.

    But where should i overwrite thismethod.

    I am creating this dialog in Clicked() of Button.

    Please tell me how to write

    Regards.

    Have a great day.

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Lookup for a Dialog field in Dialog

    Hi AX 2012 r3,

    What should happen if user check cust and vend in the same time ? Maybe it should be radio button...

    You can create custom lookup and use registerOverrideMethod to override lookup of account control, here is an example ztirom.at/.../ax2012-dialog-custom-lookup

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,902 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,297 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans