Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

How to make a field uneditable when another boolean field has a value "True" in x++

(0) ShareShare
ReportReport
Posted on by 70

I have a condition where a field named Group should not be editable when I have a value in a boolean filed as True


Regards,

C4u

  • C4u Profile Picture
    C4u 70 on at
    RE: How to make a field uneditable when another boolean field has a value "True" in x++

    From the edit method only, I have to control where the sequence number can be edited or not. Since the field is virtual string field, I cant able to override active or modified from its group control in form

    pastedimage1682508670727v1.png

    In this image, consider this as a QO and I have a condition here, I have to the make the sequence number field as not editable when I have a tick mark in the field of test result and it should be editable when the test result has the value cross.

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: How to make a field uneditable when another boolean field has a value "True" in x++

    I don't think allow edit can be controlled from within that method. Is there any reason you want to use method of virtual string (unbound control) for allow edit.

  • C4u Profile Picture
    C4u 70 on at
    RE: How to make a field uneditable when another boolean field has a value "True" in x++

    But in the code that you have given involves usage of separate methods like active, modified. I am asking for a way to use the existing method associated with the virtual string

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: How to make a field uneditable when another boolean field has a value "True" in x++

    I think still the code shared above is applicable for unbound string control (Group field). Please try it.

  • C4u Profile Picture
    C4u 70 on at
    RE: How to make a field uneditable when another boolean field has a value "True" in x++

    The field I have mentioned is a string field that has been created virtually in a form and it's been linked to a data method. Now, I have to change this one, based on a check box condition without any other method. Is there anyway I can use the method that is linked to the virtual field ?

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: How to make a field uneditable when another boolean field has a value "True" in x++

    Hi, You need to set Auto Declaration property to Yes on 'Group' control and override Modified method of this control in form design.

    public boolean modified()
    {
        boolean ret;
        
        ret = super();
        
        GroupField.allowEdit(!this.value());
        
        return ret;
    }

    Override active method of form datasource and add the below code.

      

    public int active()
    {
        int ret;
        
        ret = super();
        
        GroupField.allowEdit(!DataSourceName.BooleanField);
        
        return ret;
    }

  • Anton Venter Profile Picture
    Anton Venter 19,495 Super User 2025 Season 1 on at
    RE: How to make a field uneditable when another boolean field has a value "True" in x++

    The answer is there in the link posted by Komi. And there are hundreds of examples in the standard code by the way.

  • Komi Siabi Profile Picture
    Komi Siabi 12,759 Most Valuable Professional on at
    RE: How to make a field uneditable when another boolean field has a value "True" in x++

    Hi C4u,

    Please, can you show us the field you want to make uneditable and the boolean field(screenshots)

  • C4u Profile Picture
    C4u 70 on at
    RE: How to make a field uneditable when another boolean field has a value "True" in x++

    I didn't quite get that properly, if possible can you explain me with a piece of code ?

  • Suggested answer
    Komi Siabi Profile Picture
    Komi Siabi 12,759 Most Valuable Professional on at
    RE: How to make a field uneditable when another boolean field has a value "True" in x++

    Hello C4u,

    Check this.

    https://community.dynamics.com/ax/f/microsoft-dynamics-ax-forum/296087/enable-disable-fields-in-a-form

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans