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...
Answered

AL - How to prevent user change field's value after Purchase Order status is Released

(0) ShareShare
ReportReport
Posted on by 307

After Purchase Order is released, some fields cannot be changed but some fields are allowed to change. EX: Transaction Type

pastedimage1673592665904v1.png

How to customize to show the error when User tries to change this field value while the Purchase Order status is released ?

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    You can customize the solution OnBeforeValidate of this field and put below code

    Rec.Testfield(Status,rec.Status::Open);

    Thanks.

  • Suggested answer
    Mohana Yadav Profile Picture
    61,214 Super User 2026 Season 1 on at

    Use OnBeforeValidate trigger and standard function TestStatusOpen();

  • Hoang Ng Profile Picture
    307 on at

    Thanks Nitin, Yadav

    Is it the below code correct:

    tableextension 50110 "TLC Purchase Hdr. Ext" extends "Purchase Header"

    {

       fields

       {

           // Add changes to table fields here

           field(50110; "Deposit Date"; Date)

           {

               Caption = 'Deposit Date';

               DataClassification = CustomerContent;

           }

           modify("Transaction Type")

           {

               trigger OnBeforeValidate()

               begin

                   Rec.Testfield(Status,rec.Status::Open);

                   error('You can not change this field after PO is released');

               end;

           }

       }

    }

  • Verified answer
    Mohana Yadav Profile Picture
    61,214 Super User 2026 Season 1 on at

    Separate Error message is not required

    Just Rec.Testfield(Status,rec.Status::Open); is enough or TestStatusOpen();

  • Hoang Ng Profile Picture
    307 on at

    Thanks Yadav.

    Your way can work.

    I tried another way to show the detail message

    modify("Transaction Type")

           {

               trigger OnBeforeValidate()

               begin

                   if (rec.Status = rec.Status::Released) then begin

                       //Rec.Testfield(Status, rec.Status::Open);

                       error('You can not change this field after PO is released');

                   end;

               end;

           }

  • Suggested answer
    Mohana Yadav Profile Picture
    61,214 Super User 2026 Season 1 on at

    Just make sure that if you are using other purchase documents like Invoice or Return Order etc. and transaction type field then also the error message will show as "PO is released".

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,086 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,290 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,218

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans