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 :
Small and medium business | Business Central, N...
Answered

Modify field displayed value

(0) ShareShare
ReportReport
Posted on by 260

Greetings to all you.

I need to deal with the case below.

I have created a custom field on the item card as you can see below.

pastedimage1643024102779v1.png

Is there any way , to customize this field so that , the displayed value inside the field would be the value of the Column Name and not of the  Column No of the table? 

For example ,if i select the code 6 , atm , my custom field will display the value 6 , however i would like to display the value test instead on the item card.

Is it possible to do so? If yes, i would also need some help when it comes to the needed commands..

Thank you in advance for your time.

With respect,
Antonis

I have the same question (0)
  • Suggested answer
    Andy Sather Profile Picture
    on at

    Hello  - We currently do not have dedicated Dev support via the Dynamics 365 Business Central forums, but I wanted to provide you some additional resources to assist.  If you need assistance with debugging or coding I would recommend discussing this on one of our communities.

    www.yammer.com/dynamicsnavdev

    dynamicsuser.net/.../developers

    I will open this up to the community in case they have something to add.

  • Verified answer
    YUN ZHU Profile Picture
    95,329 Super User 2025 Season 2 on at

    Hi, This is done in two main ways.

    1. Using TableRelation property: Add code and name fields, when code is filled in, the Name field is automatically written.

    tableextension 80111 MyExtension extends Item
    {
        fields
        {
            field(50101; MainCustomerNo; Code[20])
            {
                Caption = 'Main Customer No.';
                TableRelation = Customer."No.";
                DataClassification = CustomerContent;
    
                trigger OnValidate()
                var
                    Cust: Record Customer;
                begin
                    if Cust.Get(MainCustomerNo) then
                        MainCustomerName := Cust.Name;
                end;
            }
            field(50102; MainCustomerName; Text[100])
            {
                Caption = 'Main Customer No.';
                DataClassification = CustomerContent;
                Editable = false;
            }
        }
    }
    
    pageextension 80111 MyExtension extends "Item Card"
    {
        layout
        {
            addafter(Description)
            {
                field(MainCustomerNo; Rec.MainCustomerNo)
                {
                    ApplicationArea = All;
                }
                field(MainCustomerName; Rec.MainCustomerName)
                {
                    ApplicationArea = All;
                }
            }
        }
    }

    pastedimage1643071282118v1.png

    2. Using Onlookup trigger

    tableextension 80111 MyExtension extends Item
    {
        fields
        {
            field(50102; MainCustomerName; Text[100])
            {
                Caption = 'Main Customer No.';
                DataClassification = CustomerContent;
    
                trigger OnLookup()
                var
                    Cust: Record Customer;
                begin
                    Cust.Reset();
                    if Page.RunModal(Page::"Customer List", Cust) = Action::LookupOK then
                        MainCustomerName := Cust.Name;
                end;
            }
        }
    }
    
    pageextension 80111 MyExtension extends "Item Card"
    {
        layout
        {
            addafter(Description)
            {
                field(MainCustomerName; Rec.MainCustomerName)
                {
                    ApplicationArea = All;
                }
            }
        }
    }

    pastedimage1643071564877v2.png

    pastedimage1643071575072v3.png

    pastedimage1643071590078v4.png

    Hope this will help.

    Thanks.

    ZHU

  • AntonisK Profile Picture
    260 on at

    yzhums

    Thank you so much sir.

    It worked just as i wanted to do so.

    Appreciated!

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 > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans