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)

where should I put code to disable a button on a form

(0) ShareShare
ReportReport
Posted on by 334

Hi,

I would like to disable a button on salesQuotationtable under some conditions.

but I have problem to find where to put my code 

button.enable(false);

I try to put it in active method of datasource.

I debug and make sure it did run the code. however maybe it changed status after I setup.

I open the form the button is still enabled.

so I would like to know is there a place to put the code under this scenario?

P.S : I read this article : event method sequence when a form is open

(https://msdn.microsoft.com/en-us/library/aa608211.aspx

it does even include active() method , why?

Thanks for all the answer

Quatrani

 

*This post is locked for comments

I have the same question (0)
  • Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    Could you provide some more information about your conditions/requirements, such that we can help you better.

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

    you can put your code in init() method for your form

  • JCHI Profile Picture
    334 on at

    Hi, Crispin:

    Thanks.

    The condition is:

    When the sales Quotation is generated, we write the quotation data to another system. then we have to prevent user to modify the quotation until feedback from another system.

    So what I actual want to do is prevent user to modify sales quotation

    I add code

    salesQuotationTable_DS.allowEdit(false),

    salesQuotationTable_DS.allowDelete(false)

    salesQuotationLine_DS.allowEdit(false),

    salesQuotationLine_DS.allowDelete(false)

    in active() of form datasource. which is fine.

    However I find confirm button in follow up tab of SalesQuotationTable(detailPage) is still enabled.

    So I want to disable it. when another system status of this quotation is send

    Do you have any suggestion? thanks

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    Confirm button on form SalesQuotationTable is driven(enabled/disabled) in the method enableHeaderUpdateActions. Place a breakpoint in this method and check which condition is enabling the button.  

    This method is called in the following methods on form:

    \Forms\SalesQuotationTable\Data Sources\SalesQuotationTable\Methods\active

    \Forms\SalesQuotationTable\Data Sources\SalesQuotationTable\Methods\

    selectionChanged

    \Forms\SalesQuotationLine\Data Sources\SalesQuotationLine\Methods\active

    \Forms\SalesQuotationLine\Data Sources\SalesQuotationLine\Methods\

    selectionChanged

  • Verified answer
    Srini Ramidi Profile Picture
    2 on at

    Hello,

    Confirm button is enabled/disabled based on the value of method “mayConfirmationBeUpdated” in class “SalesQuotationTableType” so you better add your logic to “SalesQuotationTableType” method to enable/disable the button.  This way you don’t need separate code for Quotation form and list page.

    Best,

    Srini

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
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans