Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Disabled field in one record in the table

Posted on by Microsoft Employee

Hello!

I want to disable field in the table, if field YesNo in the same table is No. Any ideas?

Thanks ;)

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Disabled field in one record in the table

    Please Keep one thing in mind this solution will be application on the form only, you cant have in on the table browser

    Please verify.

  • RE: Disabled field in one record in the table

    Could you post your actual lines of code, please (or at least table and field names). Maybe that would clarify things ;)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Disabled field in one record in the table

    NITESH RANJAN,  DENNIS HUESMANN thanks for your answers, but that problem is not solved :(

  • Suggested answer
    RE: Disabled field in one record in the table

    Try following code:

    YourTable_ds.object(fieldNum(YourTable, YourField)).enabled(YourValueToCheck);

    This way you do not need the AutoDeclaration flag and all occurences of the field linked to the data source are disabled/enabled depending on your condition.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Disabled field in one record in the table

    Go to the design of the form and location the text box related to the field

    Set the Auto declaration property of the text box as true

    let suppose text box name is TextBoxA

    so write following code in Active() method

    if(TableA.YesNO == 'No')

    TextBoxA.enabled(false)

    else

    TextBoxA.enabled(true)

    Please verify if this solves your problem

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Disabled field in one record in the table

    Yes, only one field in the record where other field NoYes will be no

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Disabled field in one record in the table

    are you looking to disable only the field?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Disabled field in one record in the table

    it doesn't work. I need some, like TableA.fieldToDisable.   << and after dot disable that field. Or smth like this

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Disabled field in one record in the table

    You can do it on form, by overriding 'Active()' method of the modify datasource table on the form

    let suppose datasource table name is TableA

    so write following code in Active() method

    if(TableA.YesNO == 'No')

     TableA.AllowEdit(false)

    else

     TableA.AllowEdit(true)

    Please verify and let me know if it works for you.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans