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

Sales Line customization

(0) ShareShare
ReportReport
Posted on by

Guys, i have an issue.

I was asked to make a customization so that if certain payment terms are selected, the unit prices on lines are increased. i've been trying to do this for a few days now and no success.

  • Suggested answer
    JAngle Profile Picture
    159 on at

    What is the user process likely to be? Take default payment terms from customer most of the time? Or do they need to review it and make changes per quote/order/invoice?

    Have you tried OnAfterValidate of the header field with an event subscriber yet?

    Is the % uplift static and set against the payment terms? Does the standard pricing logic override your previous attempts?

  • Suggested answer
    Tabrez Ajaz Profile Picture
    789 on at

    Hi @Yan, 

    As we know "Payment Terms Code" field is available in "Sales Header" table so make sure to update all the "Sales Lines" records related to the Sales Order, so you must have to write your code in OnAfterValidate trigger of "Payment Terms Code" field by extending the "Sales Header" Table something like this: 

    tableextension 50120 SalesHeaderExtn extends "Sales Header"
    {
        fields
        {
            modify("Payment Terms Code")
            {
                trigger OnAfterValidate()
                var
                    recSalesLine: Record "Sales Line";
                begin
                    if xRec."Payment Terms Code" <> Rec."Payment Terms Code" then begin
                        // Wrote your logic here ...................................
                    end;
                end;
            }
        }
    }
    You can also achieve this by creating a page extension for your "Sale Order" page like below: 
    pageextension 50130 SalesOrderExtn extends "Sales Order"
    {
        layout
        {
            modify("Payment Terms Code")
            {
                trigger OnAfterValidate()
                var
                    recSalesLine: Record "Sales Line";
                begin
                    if xRec."Payment Terms Code" <> Rec."Payment Terms Code" then begin
                        // Wrote your logic here                    
                    end;
                end;
            }
        }
    }
    I recommend you to write your code in table extension because the code written in Table will execute first.
    Tested in Extension:
    pastedimage1624474242228v1.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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 711 Super User 2026 Season 2

#2
Teagen Boll Profile Picture

Teagen Boll 377 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 367 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans