Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Change lookup fields default value to non-primary key

(0) ShareShare
ReportReport
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;
        }
    }

  • Suggested answer
    JAngle Profile Picture
    JAngle 33,159 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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans