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

Disable Button when Selecting Data

(0) ShareShare
ReportReport
Posted on by 209

Hello All,

I need help here.

1817.Q.png

Warehouse management > Common > Load planning workbench

If the Load Status is "Open", then the Release Button must be Enabled (Default)
If the Load Status is Not "Open", then the Release Button must be Disabled. 

must be triggered upon clicking a data.

is this possible? 

Please help, thanks.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    5400 Profile Picture
    7,162 on at

    Yes,It is possible. you can achiev through active method which will be good pratice this type scenarion. But if you want through button click also possible.

    Make release button - as autodiclartion yes

    and put the logic.

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    of course, on any form buttons can be enabled/disabled by writing code at active() method.

    But, very important thing is to know/read existing logic. how your code will behave in combination with existing business process? are those buttons already being enabled/disabled by any business process? these questions must be answered before you start writing code at active() method.

    sometimes form(s) do have a interaction class, where the buttons enable/disable is being handled based on many aspects, those need review.

    it is not about possible/impossible. its about reading your customization in combination with existing business process.

  • XSpy Profile Picture
    209 on at

    the Release button is always Enabled, I just want to add the Disable function.

    can you help me with the code? thanks.

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    check if there is existing active method on datasource; if not do override it by right clicking methods node of datasource, and then write code after super() as under

    if(condition)

       {

           ButtonName.enabled(true);

       }

       else

       {

           ButtonName.enabled(false);

       }

  • Verified answer
    5400 Profile Picture
    7,162 on at

    Please go to

    \Forms\WHSLoadPlanningWorkbench\Designs\Design\[Tab:DemandLoadsTab]\[TabPage:TabLoad]\[ActionPane:ActionPaneLoad]\[ActionPaneTab:ActionPaneTabLoad]\[ButtonGroup:Info]\[MenuButton:ReleaseMenuButton] -

    ReleaseMenuButton - do autodeclartion yes.

    \Forms\WHSLoadPlanningWorkbench\Data Sources\WHSLoadTable\Methods\active-- before return write below code

    ReleaseMenuButton.enabled(WHSLoadTable.LoadStatus == WHSLoadStatus::Open ? true : false);

  • XSpy Profile Picture
    209 on at

    Thanks Sohaib Cheema, Bhaskar Roy!

    the code works,

    but there's one more flaw here. 

    1273.W.png

    the WHSLoadTable is linked in the bottom part of the Form (Loads).

    the Load status in the upper part is also part of WHSLoadTable, but the active method only works in the bottom part of Form.

    i need it to work in the upper Load status, not the bottom one.

    *im trying the code : 

    ReleaseMenuButton.enabled(WHSLoadTable.LoadStatus == WHSLoadStatus::Open ? true : false);

    in other DataSource to see if it might work, but might as well ask if you know where to put it.

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    we are not sure about status field which is appearing in upper part, as system is in your hand; whether that belongs to WHSLoadTable or some other Datasource

    Or may be it is because of upper gird is bound to another dataSource.

    from your above screenshot(1st one) it seems that it may be part of SalesLine

  • XSpy Profile Picture
    209 on at

    yes thanks for the answers, i'll try to put it in every Datasource to try it. Thanks!

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

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans