web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

How to add custom column in Sales shipment Table and populate it with data

(0) ShareShare
ReportReport
Posted on by 160

Hello,

I am trying to add a 'Test' column of decimal type to the ' Sales shipment lines' .

I have written the following code to add the column in sales shipment lines by making an table extension in visual studio code.

fields

{

field(50120; Test ; decimal)

{

Caption='Test';

}

}

And i have also added relevant code to display the field on the page by making a page extension

But I am unable to populate it with data.

I tried to add the following code in Table extension to populate it with data from sales line to sales shipment line

modify("No.")
        {
            trigger OnAfterValidate()
            var
                SalesLine: Record "Sales Line";
            begin
                if Type = Type::Item then begin
                    SalesLine.SetRange("Document No.", Rec."Order No.");
                    SalesLine.SetRange("Type", Type::Item);
                    SalesLine.SetRange("No.",Rec."No.");
                    if SalesLine.FindSet() then begin
                        Rec."Test" := SalesLine."Outstanding Quantity";
                    end;
                end;
            end;
         }
what am I doing wrong?
is it possible to populate sales shipment line in another way?
Thank you

  • Suggested answer
    Mohana Yadav Profile Picture
    61,252 Super User 2026 Season 2 on at

    If you want to move the data from Sales Line to Sales Shipment Line then simply add the fields with same ID in both tables and system will automatically flow the data. No need to write any code.

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    Create the same field in "Sales Line" ID - 37 table as well, and delete your logic you written above OnAfterValidate and then try.

    fields

    {

    field(50120; Test ; decimal)

    {

    Caption='Test';

    }

    }

  • BBC_Astha Profile Picture
    160 on at

    Okay, I did the same and it worked.

    But how? Does BC internally flows values for all lines table?

    is this flow only one directional?

  • Suggested answer
    Mohana Yadav Profile Picture
    61,252 Super User 2026 Season 2 on at

    it uses transferfields and yes, it posts from sales line to shipment lines, invoice lines.

    learn.microsoft.com/.../transferfields-function--record-

  • BBC_Astha Profile Picture
    160 on at

    Thank you. It is very helpful.

    We can see the same in Purchase lines too right?

    Can you please tell me, how to know whether these set of tables are using Transferfields .

  • Suggested answer
    Mohana Yadav Profile Picture
    61,252 Super User 2026 Season 2 on at

    yes, it works in Purchase line side as well.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 768 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 541 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 324 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans