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

  • 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

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

    What exactly you want to achieve?

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,760 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans