Notifications
Announcements
H Experts,
I have to write a condition on a sales table form in which :
1. I have check is the customer belong to "CFR" group or not
2. If the customer belongs to CFR group we have to exit but if the customer is not from CFR group we have to check Delivery Term if found then we have to ask for Freight charge.
Please help thanks in advance
Regards
Hi ax.tech,
Can you elaborate more? You want this validation when creating new sales order?
You said need to exit the form if the customer belongs to CFR - Which form we want to exit?
Thanks,
Girish S.
To achieve you may need to write code at two place. Better to write code in a separate table method and call it where needed.
1. While creating new SO , you get option to select customer in dialog box, (SalesCreateOrder) and when selecting customer account your validation/logic needs to trigger.
2. On salesTable form where user can still change the customer, when modifying this field, you can trigger your logic.
Hi Girish,
Yes we need validation when we create a new sales order.
Form Name is Sales Table. Do i have to write validation in validate write method of the related table which is custtable?
You can write it in SalesCreateOrder dialog form - Add your logic in validateWrite method of SalesTable DataSource. So, this method will be called whenever you click on ok button on SalesCreateOrder dialog form.
Ok Girish can you please help me write this code according to logic.
Thanks and Regards
Refer to the below code. Check whether its work for your scenario.
public boolean validateWrite() { boolean ret; ret = super(); if(SalesTable.CustGroup == "CFR") { ret = checkfailed("throw error"); } if(salesTable.custGroup != "CFR") { if(salesTable.DlvTerm == "" || salesTable.FreightCharge == "") { ret= checfailed("throw error"); } } return ret; }
Thanks alot Girish for your valuable time.
Please take time to mark the answers as verified if it's solved your issue.
so, others can make use of this thread.
public boolean validateWrite() { boolean ok = true; salesline salesline; DlvTerm dlvTerm; ok = super(); ok = ok && this.validateWriteServer(); if((this.CustGroup != "CFR") && (dlvTerm.Code == "DT007" || dlvTerm.Code== "DT008" || dlvTerm.Code== "DT009" || dlvTerm.Code== "DT012" || dlvTerm.Code== "DT077" )) { ok = checkfailed("Freight charge must be filed in"); } return ok; }
I have written this code "code" is the delivery term code which is coming from dlvTerm table. Please correct me where i am wrong as this code is not running. I am not getting any error. Please help
You have written this in SalesTable datasource validateWrite method. So, you need to validate the current record when creating new sales order. But you are validation is wrong.
Just follow the code which I have sent in my previous reply. It will work for your scenario.
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…
Thanks to all of our 2025 Community Spotlight stars!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 679 Super User 2026 Season 1
Abhilash Warrier 332 Super User 2026 Season 1
Martin Dráb 238 Most Valuable Professional