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

how to prevent a value of a field from getting modified?

(0) ShareShare
ReportReport
Posted on by 625

Hi ALL,

Im quite new to D 365 BC. I have a requirement to prevent users from modifying  the value of a field from standard table on a specific condition.

PLs HElp!

Thanks in Advance!

  • Suggested answer
    Asif365 Profile Picture
    1,431 on at

    Please have a look at this post, this could help you

    stoneridgesoftware.com/.../

  • AXBOY Profile Picture
    625 on at

    Hi Asif, 

    Can't we handle this situation through c/al code?

    I don't have to disable the entire records of a table or  grant permissions to specific users.

    I have a field called Dimension Type in the standard table .

    And when the Dimension Type : A, then i want the Dimension Value filed of that same record non editable or not get modified.

    Pls help!

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    You can hanle the OnValidate trigger of this field and in this trigger place the code that manages your condition. Like:

    If not (Your condition) then

     error('You cannot modify this field');

  • AXBOY Profile Picture
    625 on at

    hi Setfano,

    Actually its a standard table where i have to do this customization,

    So i cant find the OnValidate() trigger on the table extension obejct of that standard table.

    Pls help!

  • Suggested answer
    Mohana Yadav Profile Picture
    61,252 Super User 2026 Season 2 on at

    you have to subscribe to OnAfterValidate trigger in a codeunit.

  • AXBOY Profile Picture
    625 on at

    Okay and should i call this code unit in the table extension?

  • Suggested answer
    Mohana Yadav Profile Picture
    61,252 Super User 2026 Season 2 on at

    no, event subscribers will be called automatically once the standard table onvalidate trigger is fired.

  • AXBOY Profile Picture
    625 on at

    Okay so there is no need to create a table extension for that standard table.

    I just have to create a code unit subscriing onAfterValidate event for that special field of the standard table.

    And this custom code unit created  will automatically be called whenever i change/modify the value for that field in the standard table.

    Right Mohana?

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    Absolutely yes.

    If it's a standard table, just write an event subscriber procedure to the OnAfterValidate trigger of the field you need.

  • AXBOY Profile Picture
    625 on at

    Hi ,

    I tried using the event subscriber procedure to the OnAfterValidate trigger of the specified field.

    But my Condition is if the  :

    if Rec. CodeType = Project and RecCodeValue <> ' '

    and xRec.CodeValue  <> Rec.CodeValue

    then Error(Cant Chnage the Code Value)

    Now in Code Unit using event subscriber procedure to the OnAfterValidate trigger, how can i achieve this above condition?

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 676 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 483 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 310 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans