Notifications
Announcements
No record found.
Hi Experts,
I have a confusion some time we want to make customization(bring changes) to any form. So what will be our first choice, Classes or tables.I mean to say the customization should be done by AOT classes or tables?.
Best Regards,
Shabir Ahmad
There is no single answer - some logic belongs to forms (UI logic), some to tables and some to classes. Often you have more than one option - e.g. you could put a simple logic into a table, but you'll rather create a class when it becomes more complicated.
If you want a more specific answer for your scenario, please tell us what kind of changes you have in mind.
Hi Martin,
I want to add a check on the customer master as we checked that check-box , user will not be able to make sales order for that customer and it will throw an error accordingly. This check-box will be checked by us.As it is checked it will generate that kind of error.
If you only want to prevent orders from being created on the salesTable form but do not want to touch other existing structures, you can write on the form. If this control will work in all cases, you should write it to the table.
You also need to consider the status of SalesTableListPage. As you know, code is not written to listPages.
You need to think more about the logic that you want before you can start deciding implementation details.
You said that an error should be thrown, but when? When you're selecting a customer for a new order? When you're trying to save an order with such an customer? When confirming the order? Or somewhere else?
Thanks once again for your response,
As i said before, as we checked on that customer and while we are going to make SO and in SO we select that customer account then the system throw an error. Let say i checked the check-box on customer ABC then go to Sales order and in sales order creation time sales order ask for customer account as i select Customer ABC account the system throw an error"You can not create a sales order for this customer due to this reason etc"
If you want to throw an error when changing a value of of table field, you don't have many options. You need to use validateField() method on the table. Of course, you can call a class from this table method, if you have a reason to do it. And that's what happened in this case - validateField() (indirectly) calls validateField() method of SalesTableType class.
Also, you should still put the validation on saving as well (validateWrite()), because validateField() typically isn't called if data is change in another way thay through GUI.
Thanks Martin,
That's what i was looking for, and i was saying where to use table level logic and where to use Classes level. Further, Yesterday, i made a post here Usage of classes because of this so my this point is clear here dear.
Hi Shabir,
I agree with martin's first comment. You can use both classes and table but you have to decide that what exactly you want to write and where. It depends on case to case basis so no permanent answer that either use table or class.
If it is a very small code or limited to that particular form or table then better to write code in table method and if you want to reuse the same code or function better to create class and wherever required you can declare the class object and call the method.
Hi Jay Barot,
I got the view of Martin, i am cleared what he said the purpose of my post was to Clear 2 things 1 is how to get the requirement on customer master form, which martin cleared me and the 2 point was if we are using table level methods then where we will use these classes attached with all modules and its functionalities Matin said to use Class SalesTableType how i will know that other sales and customers related classes will be used. Hope so you will get my point.
actually before writing any code anywhere, please check if you could rather use the standard functionality to solve your business requirement. You should consider using "Invoice and delivery on hold" field in Customer form - Credit and Collections FastTab.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 490 Super User 2025 Season 2
Martin Dráb 429 Most Valuable Professional
BillurSamdancioglu 241 Most Valuable Professional