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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Reference to other table Field

(0) ShareShare
ReportReport
Posted on by

Hello guys,

Since you have helped me a lot by now and are the ultimate source of expert AX knowledge, I came up with one more question. I have two tables: PersonDir and EmployeesPFA (custom made). In personDir table I added a field pfaRecId which should create relation to employeePFA table (pfaRecId == recId). What is more, in HcmWorker form, I added a field EmployeesPFA that shows the workers PFA and when record is being edited should let choose from all the PFA values stored in EmployeesPFA table and save the reference to it in that PersonDir table pfaRecId field. How should this be done? Thank you.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    Hi Dsatkus,

    If you have relation between PersonDir and EmployeesPFA created on PersonDir then you need to drop pfaRecId  field on HcmWorker from and AX will add "ReferenceGroup" control that automatically shows employeePFA  natural key instead of recid.

    You can read more about reference groups and reference datasources on msdn msdn.microsoft.com/.../gg845085.aspx or check this blog article  dev.goshoom.net/.../replacement-groups-in-ax-2012

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    For reference, we discussed in your previous thread that you can't access objects you need because your code is in a wrong package. It seems that you did everything as customizations, including adding the field to PersonDir and therefore you can't use it fro referencing a table in Application Suite.

    Therefore remove your customization from the Directory package and the field as an extension. Ideally remove all customizations from Application Suite as well and put all your code to a separate package. Adding a new table and adding fields to a form don't require overlayering.

  • Community Member Profile Picture
    on at

    So you suggest adding a field to a form as an extension? Regarding good practice, when should I use customization and when extension?

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    You should avoid changing code owned by other company (such as Microsoft) whenever possible, because if you do it, you can get into troubles when they change their code and you have to do deal with overlayering conflicts. Also, you aren't even allowed to do it in some cases, so you have no choice. That's why there is the whole concept of extensions, which allows you to add features without changing somebody else's objects. You keep your changes in a separate package without any risk of overlayering conflicts and you can also compile and distribute this package separately.

    It's not always possible, but you should do it when it is.

    The topic of extensions and customizations has been discussed quite a few times - please look at a few articles on internet, because it's extremely important to understand it. You already see which troubles you get into if you aren't familiar with these things.

  • Community Member Profile Picture
    on at

    I started using customization since I needed to customize an enum which is non extendable. So you would suggest me recreate  the project using only extensions?

  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    First of all, you see that customizing the Directory package doesn't allow you to achieve what you need, so you have to change your approach whether you want or not.

    That you have to overlayer an enum doesn't mean that you should use customization for everything else as well. You can customize the enum and then put everything else to a separate package.

  • Community Member Profile Picture
    on at

    So, as I understand, I should create a project in my own built package  and recreate everything using extensions in it and leave the project using a model of Application Suite package only with customized enum. Are they going to interact well?

  • Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    I'm not sure what you mean by "to interact", but you'll be able to access all public objects from all packages referenced by your package.

    Note that projects are placed inside packages - they're stored separately from code and metadata.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans