Skip to main content

Notifications

Announcements

No record found.

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 99

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
    Mohana Yadav 59,194 Super User 2024 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.

  • BBC_dhanvi Profile Picture
    BBC_dhanvi 99 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
    Mohana Yadav 59,194 Super User 2024 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_dhanvi Profile Picture
    BBC_dhanvi 99 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
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 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';

    }

    }

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,194 Super User 2024 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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans