Skip to main content

Notifications

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.

  • Gokhan Cakir Profile Picture
    140 on at
    RE: How to Allow or Not Allow Edit on Purchase Order?

    Thank you Martin,

    I learned something nice from you.

    Best Regards!

  • Suggested answer
    Martin Dráb Profile Picture
    234,065 Most Valuable Professional on at
    RE: How to Allow or Not Allow Edit on Purchase Order?

    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
    RE: How to Allow or Not Allow Edit on Purchase Order?

    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
    Komi Siabi Profile Picture
    12,884 Most Valuable Professional on at
    RE: How to Allow or Not Allow Edit on Purchase Order?

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

    if(condition)
    {
        purchTable_ds.allowEdit(false);
        purchLine_ds.allowEdit(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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 601 Most Valuable Professional

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 416

#3
Adis Profile Picture

Adis 384 Super User 2025 Season 1

Product updates

Dynamics 365 release plans