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

Item Tracking Code as TableRelation in Item table

(0) ShareShare
ReportReport
Posted on by

Hi 

I want to show 2 fields from "Item Tracking Code" on my "Item Card" pages. 

These 2 fields are: "SN Specific Tracking" and "Lot Specific Tracking".

for this I've created 2 fields on Item table and Item Card as follow

Item Table:

field(1; SerialNo; Boolean)
        {
            TableRelation = "Item Tracking Code"."SN Specific Tracking" WHERE(Code = FIELD("Item Tracking Code"));
            ValidateTableRelation = true;
        }
        field(2; LotNo; Boolean)
        {
            TableRelation = "Item Tracking Code"."Lot Specific Tracking" WHERE(Code = FIELD("Item Tracking Code"));
            ValidateTableRelation = true;
        }

Item Card: 

field(LotNo; LotNo)
            {
                ApplicationArea = All;
                Visible = true;
            }
            field(SerialNo; SerialNo)
            {
                ApplicationArea = All;
                Visible = true;
            }

But when I run Item Card page and try to change the value. I get this error:

The following field must be included into the table's primary key: Field: Lot Specific Tracking Table: Item Tracking Code

I have the same question (0)
  • THE Italian Profile Picture
    on at
    RE: Item Tracking Code as TableRelation in Item table

    What exactly you want to achieve?

  • Suggested answer
    THE Italian Profile Picture
    on at
    RE: Item Tracking Code as TableRelation in Item table

    Ok. I think I understand what you want to achieve. What you wrote is incorrect. You need a lookup flowfield.

    Try this in your table (you have to force the recreation of the fields)

    tableextension 50115 "ItemTableExt" extends Item

    {

       fields {

               field(50100; SerialNo; Boolean)

               {

                   FieldClass = FlowField;

                   CalcFormula = lookup("Item Tracking Code"."SN Specific Tracking" WHERE(Code = FIELD("Item Tracking Code")));

                   Editable = false;

               }

               field(50101; LotNo; Boolean)

               {

                   FieldClass = FlowField;

                   CalcFormula = lookup("Item Tracking Code"."Lot Specific Tracking" WHERE(Code = FIELD("Item Tracking Code")));

                   Editable = false;

               }

       }

    }

    and this is the final result that you are looking for

    pastedimage1596124173249v1.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…

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,377

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,696 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,512 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans