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 :
Microsoft Dynamics AX (Archived)

How to make field editable based on condition

(0) ShareShare
ReportReport
Posted on by 932

i have a form with a grid. when the grid is populating its data, i want to change yes/no enum field to yes. when I change this field another field became editable. Example, If FieldA == Yes then FieldB.allowedit(true). 
i put the code into the datasource's active method, but it doesn't work
please advice?

this is my code : 

if (SPLCalculRistourneMois.objectif==NoYes::Yes)

SPLCalculRistourneMois_ds.object(fieldNum(SPLCalculRistourneMois,TauxRistourne)).allowEdit(true);

else
SPLCalculRistourneMois_ds.object(fieldNum(SPLCalculRistourneMois,TauxRistourne)).allowEdit(false);

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mariano Gracia Profile Picture
    on at

    You almost have it, write the same code in the objectif datasource field modified method

  • BASMA Profile Picture
    932 on at

    Hi mariano,

    I delete this code from the active method?

  • Mariano Gracia Profile Picture
    on at

    No, indeed you need it

  • BASMA Profile Picture
    932 on at

    I add this code in the modified method of field "objectif" but the same problem?

  • Suggested answer
    Mahmoud Hakim Profile Picture
    17,887 on at

    You can check this link

    axaptadevmallik.blogspot.ae/.../form-field-allow-edit-based-on-conditons.html

  • BASMA Profile Picture
    932 on at

    Hi Mahmoud,

    thanks fo your reply but i have the same problem.

  • Jonathan  Halland Profile Picture
    11,310 on at

    BASMA.

    As per Mariano's suggestion you need both. The "active" will handle when you move from row to row and want to set the fields property based on existing value. The "modifiedField" will set the editable status based on what you have just changed.

    Maybe if you put you code from both these methods in it may be useful.

    Can you also confirm what the actual field's editable state is on the table?

  • BASMA Profile Picture
    932 on at

    hi Jonathan,

    Yes i put the code in the active method and in the modifiedField but i have the same problem,

    the field editable has the property on the table"allowedit=false"

  • Mariano Gracia Profile Picture
    on at

    If the table field has the property allowedit to false you will never be able to edit it even with your code, you must allow to edit it and then control the property by code

  • BASMA Profile Picture
    932 on at

    Thanks Mariano,my problem is solved.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans