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

Making Vendor bank details so they cannot be edited

(0) ShareShare
ReportReport
Posted on by 37

Hi. I have an urgent requirement to make vendor bank details non - editable once in. I have a workflow on the vendor card for changes so if someone changes the preferred bank code it will need to be authorised.

The theory is to make vendor bank details error if the account number is changed but if it is a new record allow them to be entered. Then on the payment journal make it so that changes to the preferred bank account can not be edited and must come from the vendor card. (I was thinking make this field not visible on the journal - if they can't get to it they can't edit it.)

I have tried by creating a boolean for a new record. The using the OnValidate check if it is a new record - if it is exit, if not error. 

I have tried with a table extension(first with no success) using the OnBeforeInsert trigger to set NewRec true and then on a page extension using the OnOpenPage to do the same.

I have put the code below: The result is I can't edit the Bank Account number on an existing record - when you navigate away from the page it gives the error message which is what I wanted, but I can't edit the bank account number on a new record either! Can someone point me in the right direction? It appears to me that my variable NewRec never gets initialised. Please help!

pageextension 50100 "Vend Bank Card Ext" extends "Vendor Bank Account Card"
{
    layout
    {
        modify("Bank Account No.")
        {
            trigger OnBeforeValidate()

            begin
                if NewRec = true then
                    exit
                else
                    Error('Cannot change Bank details - Create a new record');
            end;

            trigger OnAfterValidate()

            begin
                if NewRec = true then
                    exit
                else
                    Error('Cannot change Bank details - Create a new record');
            end;
        }
    }

    actions
    {

    }
    trigger OnOpenPage()

    begin
        if rec.Code <> '' then
            NewRec := true;
    end;

    var
        NewRec: Boolean;
}
  • Suggested answer
    Suresh Kulla Profile Picture
    50,280 Super User 2026 Season 1 on at

    You could add something like this because for new records Bank Account No. is blank and if they try to modify after it has a value then it will error out.

    trigger OnAfterValidate()

               begin

                   if (Rec."Bank Account No." <> xRec."Bank Account No.") and (xRec."Bank Account No." <> '') then

                       Error('Cannot Edit')

               end;

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 August Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 710 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 413 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 387 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans