Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to disable a button on a form based on the selected record

(0) ShareShare
ReportReport
Posted on by 150

When I select a record on the form and the status field(type enum) of the record  is "start" then the button "pickup " in the form  should be enabled.

Then I edit the record and update it from the form and  the status becomes "stop". Then when I select the record , then the "pickup" button should be disabled.

Where should I write the code in form level ? At the data source of the form or in form>datasource>field(status)>method?

Could you show the code..I am a beginner in ax2012

  • PrachiGupta97 Profile Picture
    PrachiGupta97 150 on at
    RE: How to disable a button on a form based on the selected record

    In an extension of a standard form in d365 , the active method can't be overridden. 

    1)So do we use event handlers ? If so which one?

    2)If I have multiple datasources in the form , then for which one do we write the code? 

  • Blue Wang Profile Picture
    Blue Wang on at
    RE: How to disable a button on a form based on the selected record

    Hi Sir,

    I found an earlier thread with consistent requirements, please refer to:

    community.dynamics.com/.../disable-button-when-selecting-data

  • Verified answer
    Blue Wang Profile Picture
    Blue Wang on at
    RE: How to disable a button on a form based on the selected record

    Hi PrachiGupta,

    You can override active() of datasource.

    Code like this:

    Button.enabled(Table.LoadStatus == Status::Start ? true : false);

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans