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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Field related to two tables

(0) ShareShare
ReportReport
Posted on by 788

Hello, 

I have a table with an int64 (no EDT) field, I want this field related to either the ERModelMappingTable or the ERFormatMappingTable (depending on an enum value). 

pastedimage1678959063608v1.png

In the form I have a reference group:

pastedimage1678959281682v3.png

public Common lookupReference()
        {
            if(XYZ_ERTable.Direction == XYZ_Direction::Export)
            {                
                return ERFormatMappingTable::lookup(this, CustVendOutPaymConstants::modelName, CustVendOutPaymConstants::creditTransferContainerDescriptorName);
            }
            else
            {
                return ERModelMappingTable::lookup(this, classStr(ERTableDestination)   '#'   tableStr(XYZ_XYZ_HeaderTableEntity));
            }
        }

So the lookup filtering works great, but when selecting an ERFormatMapping (The second relation) I get the error: 

pastedimage1678959559476v4.png

So what I'm looking for a polymorphic lookup, also the field to show a descriptive text and not a RecId (already does that but I'm not sure how). 

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    299,149 Super User 2025 Season 2 on at
    RE: Field related to two tables

    Hi Arcadi,

    You mentioned that the relation would depend on an enum value, but you haven't added the enum to the relations. You only used it to distinct the lookup. Ensure you will add the enum with the correct condition in the table relations for your two referenced tables.

  • Arcadi  Profile Picture
    788 on at
    RE: Field related to two tables

    You are right André my relation was wrong and now works at a table level (With RecIds). But I'm getting the same error in the form. I think the reason is that I need to select a reference field in the reference group, So I have to choose between the fields of the format table or the fields of the model.

    pastedimage1679042484681v1.png

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,167

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 867 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 617 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans