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 :
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

I have the same question (0)
  • Suggested answer
    Komi Siabi Profile Picture
    13,107 Most Valuable Professional on at
  • C4u Profile Picture
    70 on at

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

  • Komi Siabi Profile Picture
    13,107 Most Valuable Professional on at

    Hi C4u,

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

  • Anton Venter Profile Picture
    20,345 Super User 2025 Season 2 on at

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

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    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;
    }

  • C4u Profile Picture
    70 on at

    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 ?

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

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

  • C4u Profile Picture
    70 on at

    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
    12,565 Moderator on at

    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
    70 on at

    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.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans