web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Turning fields invisible or not editable on 2013

(0) ShareShare
ReportReport
Posted on by 1,647

Is there a way to turn invisible or not editable fields on page when certain criteria happens?

on old version the code was:

Currform.MyField.VISIBLE := FALSE;
Currform.MyField.EDITABLE := FALSE;

Since I upgrade to 2013 the code change I'm in learning process again ;)

Thank you in advance.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Yes you can accomplish this in 2013. Create a new boolean variable and in the properties of the variable set IncludeInDataSet to yes. Assign this variable to the page field Editable property.

    Add the code on the open page, onaftergetrecord, onaftergetcurrrecord to set the variable to true or false based on your requirement.

  • keoma Profile Picture
    32,729 on at

    that mentioned variable needs to be a global one.

  • spyroot Profile Picture
    1,647 on at

    I did what you suggested.

    On the following example I'm trying to hide Description field. I know that code below is not correct but I"m trying to find out how the variable will drive the behavior of the field to hide.

    Under Description properties I have changed Visible = TurnIvisible

    OnAfterGetRecord()

    ---------------------------------

    IF "EVENTHAPPEN" THEN

     TurnInvisible := FALSE;    <--  TurnInvisible is the new variable that you suggested

    CurrPage.Description := TurnInvisible;

    Please advise.

  • Suggested answer
    keoma Profile Picture
    32,729 on at

    CurrPage.Description := TurnInvisible; makes no sense.

    only use:

    IF "EVENTHAPPEN" THEN

    TurnInvisible := FALSE;

    or better:

    TurnInvisible := NOT ("EVENTHAPPEN");

  • spyroot Profile Picture
    1,647 on at

    Thanks Jonathan for helping me out..

    This is what I have so far and is not working for me yet :(

    TurnVisible is a Boolean Variable with IncludeInDataset= YES

    Under Description field properties, I have change Visible = TurnVisible instead TRUE

    Now on AfterGetRecord()__________

    IF "Blocked Field" = TRUE THEN

     TurnVisible := FALSE

    ELSE

     TurnVisible := TRUE;

    Unfortunately is not working. What I'm missing???

    Thanks again for all your help folks.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    Add the above code in OnOpenPage trigger and also OnAfterGetCurrRecord.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    For an example refer to the customer card page how contact field is set. The ActivateFields function on that page, controls whether that field is editable or not.

  • Suggested answer
    Tharanga Chandrasekara Profile Picture
    23,118 on at

    Add your code in the  OnOpenPage trigger and also in the OnAfterGetCurrRecord trigger.

  • spyroot Profile Picture
    1,647 on at

    It works!

    Unfortunately when I change to next record using the arrows from top header menu, the field still invisible even if the rules does not apply to that particular record. I have to close the page and open the next record from list page.

    Any suggestions?

  • Suggested answer
    Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at

    Did you write code in OnAfterGetCurrRecord trigger?

    also OnNextRecord trigger?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans