Skip to main content

Notifications

Business Central forum
Answered

Change lookup fields default value to non-primary key

Posted on by Microsoft Employee

I've created a new table named 'Jurisdiction', and on my existing Job card I've added a field that is a lookup of Jurisidictions. How can I set this field to display the 'name' value of the selected record instead of the 'ID' value which is currently the primary key of the Jurisdiction table?

pastedimage1643411767335v1.png

Here is the source of my lookup field:

        field(50101; Jurisdiction; Code[100])
        {
            DataClassification = ToBeClassified;
            Caption = 'Jurisdiction';
            TableRelation = Jurisdictions.ID;
        }

And here's the source of my new Jurisdictions table:

table 50101 Jurisdictions
{
    DataClassification = ToBeClassified;

    fields
    {
        field(1; ID; Integer)
        {
            DataClassification = ToBeClassified;
            AutoIncrement = true;
        }
        field(2; Name; Text[250])
        {
            DataClassification = ToBeClassified;
            Caption = 'Name';
        }
    }

    keys
    {
        key(PK; ID)
        {
            Clustered = true;
        }
    }

Categories:
  • Suggested answer
    JAngle Profile Picture
    JAngle 33,155 on at
    RE: Change lookup fields default value to non-primary key

    This might help: community.dynamics.com/.../modify-field-displayed-value

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

Dynamics 365 Community Update – Sep 16th

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

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 228,441 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans