web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Disable Edit button and Making form Read only

(0) ShareShare
ReportReport
Posted on by 432

Hello Experts,

I have to disable Edit button and make form read only  on a particular condition.

I have salesTable form .  and In SalesTable there is Customised field inProcess of Enum Type  noyes.

When field value is noyes::yes i.e yes then form should not editable  to any users.

Please let me know where to write code in which events in D365 FFO on premise.

Thanks in Advance

*This post is locked for comments

I have the same question (0)
  • Percy Nxumalo Profile Picture
    115 on at
    RE: Disable Edit button and Making form Read only

    /// <summary>

    /// Extension class for <c>SalesTableType</c> class.

    /// </summary>

    [ExtensionOf(classStr(SalesTableType))]

    final class SalesTableType_Extension

    {

    public boolean checkUpdate(boolean _useWarning,
    boolean _interCompanyCheck,
    boolean _treatInvoicedOrderUpdateWarningAsError)
    {

     

    boolean        ret;

      SalesTable             salesTable = salesTableType.parmSalesTable();

      FormDataSource  formDataSource = FormDataUtil::getFormDataSource(salesTable);

      ret = next checkUpdate(

              _useWarning,

              _interCompanyCheck,

              _treatInvoicedOrderUpdateWarningAsError);

      if (formDataSource

          && salesTable.inProcess) // Your custom field

      {

           ret = false;

      }

      return ret;    

    }

    }

  • Suggested answer
    Martin Dráb Profile Picture
    236,279 Most Valuable Professional on at
    RE: Disable Edit button and Making form Read only

    It depends on a property of SalesTable, therefore you must reevaluate the condition every time when the user switches to another sales order. Subscribing to the OnActivated event of the data sources sounds like the best approach.

    Then you will want to pass either true or false to allowEdit() method of the datasource.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans