-
To disable buton on form using the checkbox on custom formYou're lucky! If you believed that your code worked and shipped it, you would break your customers ERP system! You must be more careful.There already is standard logic to decide whether a confirmation can be posted, which your completely ignore. If you managed to overwrite the value, you'd have break the standard logic. Also, if you want to prevent confirmation posting, you need to take all the related buttons into account. All the button will be handled if you do it at the right place: SalesTableType.canConfirmationBeUpdated(). What you should have done is considering that standard logic may exist (if you don't already know that the buttons are disabled in some case, which proves that some logic must exist). Then you should have used Find references to find the place and analyze code further to find the right place to extend.Your handling of LineStripNew is wrong too. I'm assuming that you want to prevent line creation, but you didn't. You disabled a button but users can still use keyboard shortcuts. The correct approach is using allowCreate() of salesLine_ds.You can throw away your select of userInfo and the salesLine variable.If accessing the button was the correct thing to do, you could greatly simplify your code by using element object to access the form. Then you can use, for example, element.buttonUpdateConfirm to access the confirmation button.
-
To disable buton on form using the checkbox on custom formhiThanksFor reply ,I was trying to enable and disable the button on current user but , the button add line on the salestable form is getting enable disable but the menuitem button is not getting disable as i have debugged the code debugger is hitting the condition . please guide me is anything i need to change to disable menuitem button .below is my code.
[ExtensionOf(formdatasourceStr(SalesTable, SalesTable)) ] final class DTSalestableForm_AssignTransactionAccess_Extension { public int active() { UserId userid ; UserInfo userInfo; DTSalesTransactionAccess salesAccess; SalesTable salesTableLoc = this.cursor(); SalesLine salesLine; int ret = next active(); userid = curUserId(); select id from userInfo where userInfo.id == userid; while select * from salesAccess where salesAccess.UserId == userInfo.id { if(salesAccess.RecId != 0 && salesAccess.inventLocationId == salesTableLoc.InventLocationId) { if(salesAccess.Addlines == NoYes::Yes) { this.formrun().design().controlName(formControlStr(SalesTable, LineStripNew)).enabled(true); } else { this.formrun().design().controlName(formControlStr(SalesTable, LineStripNew)).enabled(false); } if(salesAccess.Confermation == NoYes::Yes) { this.formrun().design().controlName(formControlStr(SalesTable, buttonUpdateConfirm)).enabled(true); } else { this.formrun().design().controlName(formControlStr(SalesTable, buttonUpdateConfirm)).enabled(false); } } else { this.formrun().design().controlName(formControlStr(SalesTable, LineStripNew)).enabled(true); this.formrun().design().controlName(formControlStr(SalesTable, buttonUpdateConfirm)).enabled(true); } } return ret; } }
-
To disable buton on form using the checkbox on custom formHiCan you explain your requirements in another way, as your comment isn't clear?Thanks,
Waed Ayyad -
To disable buton on form using the checkbox on custom formYes, you'll want to check your condition when a sales order is selected, therefore in active().You didn't describe the logic you want, e.g. whether you want to somehow check warehouses of all lines in the given order, therefore I can't tell you exactly you can implement these unknown requirements. But in general, you'll decide which record in your table you're interested in, you'll find it (by find() method, select statement or so) and then you'll get the field value (e.g. myTable.MyField).
Helpful resources
Quick Links
Subscribe to
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
Leaderboard
Andre Arnaud de Cal... 283,176 Super User
Martin Dráb 222,727 Super User
nmaenpaa 101,138