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 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.
Thank you Martin,
I learned something nice from you.
Best Regards!
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.
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; }
On the active method of the PurchTable datasource, you can set a condition.
if(condition) { purchTable_ds.allowEdit(false); purchLine_ds.allowEdit(false); }
Martin Dráb
601
Most Valuable Professional
Abhilash Warrier
416
Adis
384
Super User 2025 Season 1