Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

HowTo Add Column [CategoryName] field to a Lookup field [CostCategoryId] AX2012

(0) ShareShare
ReportReport
Posted on by 44

Hello,

I have a custom Form with two Foreign keys ProdRoute.OprId and RouteCostCategory.CostCategoryId which I am linking toghether in the custom table as well. I just want to modify the standard lookup field for the EDT RouteCostCategoryId to add the Description of that cost category which is in the Share Categories table (SharedCategory.CategoryName)

Even better make a copy of the EDT and then modify it so it can show the CategoryName

pastedimage1591362594148v1.png

Thanks a lot!

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: HowTo Add Column [CategoryName] field to a Lookup field [CostCategoryId] AX2012

    Hi Sergei.

    mmm ok. so no straight copy code for  standard lookups. I already tried sysTableLookup  I think I know how to handle it. I thought the lookup where EDT-related or something like that.

    Anyway thanks for your help I will set this thread as Solved. Thanks a lot!

  • Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: HowTo Add Column [CategoryName] field to a Lookup field [CostCategoryId] AX2012

    Hi CBNestor,

    Yes, in this case you need to use sysTableLookup class and lookup method on form datasource field. Check InventLocation.lookupBySiteId method and how it's used.

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: HowTo Add Column [CategoryName] field to a Lookup field [CostCategoryId] AX2012

    Hi Sergei,

    I know what you mean, Yes now I am change the Standar lookup field. I can show the all 3 fields now. But if I want to leave the standard lookup as it is. I make one on my own. So I can show the 3 fields just when and where I want to. Is it possible to make some kind of a copy and customize from that copy?

  • Verified answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: HowTo Add Column [CategoryName] field to a Lookup field [CostCategoryId] AX2012

    Hi CBNester,

    You need to add fields CostCategoryId and CostGroupId to the field group as well.

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: HowTo Add Column [CategoryName] field to a Lookup field [CostCategoryId] AX2012

    No the CostGroupId is gone. Thats why I wanted to make some kind of copy of the lookup, customize it and the use it in my custom form. I dont want to change the whole Lookup in whole system

    pastedimage1591602986551v2.png

  • Suggested answer
    Jay Barot Profile Picture
    Jay Barot 1,502 on at
    RE: HowTo Add Column [CategoryName] field to a Lookup field [CostCategoryId] AX2012

    Hi CBNestor,

    if you don't need to filter anything on this field then I suggest to use display method.  Else you need to develop custom lookup  as suggested by sergei.

  • Verified answer
    Sergei Minozhenko Profile Picture
    Sergei Minozhenko 23,089 on at
    RE: HowTo Add Column [CategoryName] field to a Lookup field [CostCategoryId] AX2012

    Hi CBNestor,

    Just drop needed fields to the group (from fields node) and display method from methods node.

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: HowTo Add Column [CategoryName] field to a Lookup field [CostCategoryId] AX2012

    Hi Sergei,

    I have the display on RouteCostCategory. I dont see any fields in the RouteCostCategory AutoLookup fGroup. how to add that. thank you

    Display CategoryName GetCategoryName()

    {

       SharedCategory _sc;

       select CategoryName from _sc

       where _sc.CategoryId == this.CostCategoryId;

       return _sc.CategoryName;

       //return _sc.find(this.CostCategoryId).CategoryName;

    }

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: HowTo Add Column [CategoryName] field to a Lookup field [CostCategoryId] AX2012

    Hi Blue,

    This is what I would like to know where is that implemented orginally where can I find the code.

  • Verified answer
    Blue Wang Profile Picture
    Blue Wang on at
    RE: HowTo Add Column [CategoryName] field to a Lookup field [CostCategoryId] AX2012

    HI CBNestor,

    As mentioned, the display method should suit your needs.

    You need to check how the lookup of the Category field is implemented, only add another field. please check this thread for the logical method.

    community.dynamics.com/.../348223

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,642 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans