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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

How to Allow or Not Allow Edit on Purchase Order?

(0) ShareShare
ReportReport
Posted on by 106

I added a comboBox type field called "Status" with the values ​​Open and Blocked on the PurchTable form and I want to write a method that does not allow editing any information from Purchases Order if the Blocked value is selected.

I have the same question (0)
  • Suggested answer
    Komi Siabi Profile Picture
    13,109 Most Valuable Professional on at

    On the active method of the PurchTable datasource, you can set a condition.

    if(condition)
    {
        purchTable_ds.allowEdit(false);
        purchLine_ds.allowEdit(false);
    }

  • Gokhan Cakir Profile Picture
    140 on at

    Hi Pavel,

    You have to override called "active" method in PurchTable.

    For example;

    public int active()
    {
        int ret;
        ret = super();
        //Just you can edit PurchTable if Your Costom Field is Open
        purchTable_ds.allowEdit(PurchTable.YourCustomField == Open);
        return ret;
    }

  • Suggested answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    The problem with previous answers is that they don't take existing logic into account.

    For example, if you followed Gökhan suggestion, you would make the order editable if your status is Open, even if the order is in workflow or already invoiced (and the system is configured not to allow changes to invoiced orders). That would be a bug.

    An appropriate place for your logic may be PurchTable.checkUpdate(). And make sure you don't set the value to true if the standard logic returns false. For example:

    boolean checkUpdate(
    	boolean  _useWarning,
    	boolean _interCompanyCheck,
    	boolean _treatInvoicedOrderUpdateWarningAsError)
    {
    	boolean allowEdit = next checkUpdate(_useWarning, _interCompanyCheck, _treatInvoicedOrderUpdateWarningAsError);
    	
    	if (this.MyStatus == MyOrderStatus::Blocked)
    	{
    		allowEdit = false;
    	}
    	
    	return allowEdit;
    }
          

    Gökhan, please always use Insert > Code (in the rich-formatting view) to paste source code. It'll prevent the extra spaces between lines (when you post each line as a separate paragraph), it adds kine numbering and so on.

  • Gokhan Cakir Profile Picture
    140 on at

    Thank you Martin,

    I learned something nice from you.

    Best Regards!

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 551 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans