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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Show less fields in a lookup form

(0) ShareShare
ReportReport
Posted on by 475

Hi,

I have created a display method in the job for the purchase table and i want only purchid to be shown in the dialog box.2018_2D00_06_2D00_13-16_5F00_51_5F00_00_2D002A20_Microsoft-Dynamics-AX_2C20_-_2D00_-_0E202A20_Karya-Technologies-_2800_India_2900_-Pvt-Ltd_2C20_-_5B000E202A20_DYNAXT_2C202A205F00_-_0E202A20_S.png

But i am getting all the values from the purchtalbe.

Please advice

Regards,

Bharath K

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Catalyst619 Profile Picture
    355 on at

    Looks like you might need a lookup as opposed to a display method.

    Have a read here on how to implement one:

    community.dynamics.com/.../dynamics-ax-form-lookups-and-how-they-work

  • bharathkarunakaran Profile Picture
    475 on at

    Thanks for your reply Aleks,

    I  Solved the problem.

  • Martin Dráb Profile Picture
    239,082 Most Valuable Professional on at

    bharathkarunakaran, can you share your solution, please? It could help somebody else who finds this thread later.

    Also, please use more descriptive title than "Reg. Display method..". I've updated this thread's title for you. And you've attached the version tag "current version", which is Dynamics 365 for Finance and Operations, but your picture is from a different version. Please update it.

  • bharathkarunakaran Profile Picture
    475 on at

    Thank you martin,

    I am newbie and I not sure about the version ,thanks getting me corrected that I won't repeat the mistake again.

    class DialogLookup_bharath extends RunBase

    {

       Dialog dialog;

       FormStringControl  control;

       DialogField   fieldLookup;

       PurchTable Purchtable;

    }

    protected Object dialog()

    {

       dialog = super();

       dialog.caption("My custom dialog box");

       fieldLookup = dialog.addField(extendedTypeStr(PurchIdBase),"PurchId:");

       control = fieldLookup.control();

       control.registerOverrideMethod(methodStr(FormStringControl,lookup),methodstr(DialogLookup_bharath,lookup),this);

       return dialog;

    }

    public void lookup(FormStringControl _control)

    {

       Query  query = new Query();

       QueryBuildDataSource querybuilddatasource;

       SysTableLookup  systablelookup = SysTableLookup::newParameters(tableNum(PurchTable), _control);

       systablelookup.addLookupfield(fieldNum(PurchTable,PurchId));

       querybuilddatasource = query.addDataSource(tableNum(PurchTable));

       systablelookup.parmQuery(query);

       systablelookup.performFormLookup();

    }

    public void run()

    {

       PurchIdBase  getPurchId;

       getPurchId = fieldLookup.value();

       if(dialog.closedOk())

       {

           while select Purchtable

           {

               if(Purchtable.PurchId == getPurchId)

               {

               Global::info(strFmt('%1-%2-%3-%4-%5-%6-%7', PurchTable.PurchId,PurchTable.Orderaccount,PurchTable.PurchName,PurchTable.Invoiceaccount,PurchTable.Purchstatus,PurchTable.Documentstatus,PurchTable.DeliveryDate));

                break;

               }

           }

       }

    }

    static void main(Args  _args)

    {

       DialogLookup_bharath dialoglookup =new DialogLookup_bharath();

       if (dialoglookup.prompt())

       {

           dialoglookup.run();

       }

    }

    This how I reduced the fields in the lookup form by using dialog box.

    I have written the run method to display the PUrchID details whenever i select the purchid and click OK   using the clickedOK method.

    Regards,

    Bharath K

  • bharathkarunakaran Profile Picture
    475 on at

    hi guys,

    I have one more doubt,

    Can somebody suggest me how to do the above task using job.

    Regards

    Bharath K

  • Suggested answer
    nmaenpaa Profile Picture
    101,166 Moderator on at

    Why would you want to do it in a job? Use a class like you already do. If you for some reason want to run it from a job, just call your class from a job.

  • bharathkarunakaran Profile Picture
    475 on at

    Thanks for the Reply ,

    Is this the only way to do this??

    Are they any other way to do this?

    Regards,

    Bharath K

  • nmaenpaa Profile Picture
    101,166 Moderator on at

    Other ways to do what? Usually there are many ways to do most things. 

    You can create a dialog directly in a job. But why would you want to? What is the business requirement? 

  • bharathkarunakaran Profile Picture
    475 on at

    For learning purpose i want to do that thing by means of job,

    Where in the dialog only one field must be there and I should gets the details for that field in info box.

    For Ex.

    If it purhid the details of that purchid should be displayed in the info box

    Please advise

    bharath k

  • Bhanu Pratap Singh Profile Picture
    272 on at

    Hello Bharath,

    requirement can be fulfill using different ways. but there are some set process or best practice to follow, you may find details at

    msdn.microsoft.com/.../aa658028.aspx .

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
Basit Profile Picture

Basit 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans