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

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

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at
    RE: How to add custom column in Sales shipment Table and populate it with data

    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,698 Moderator on at
    RE: How to add custom column in Sales shipment Table and populate it with data

    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
    RE: How to add custom column in Sales shipment Table and populate it with data

    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
    60,993 Super User 2025 Season 2 on at
    RE: How to add custom column in Sales shipment Table and populate it with data

    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
    RE: How to add custom column in Sales shipment Table and populate it with data

    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
    60,993 Super User 2025 Season 2 on at
    RE: How to add custom column in Sales shipment Table and populate it with data

    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

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