public boolean validateField(FieldId _fieldIdToCheck) { boolean ret; ret = next validateField(_fieldIdToCheck); TaxInformationVendTable_IN tax; if(_fieldIdToCheck == fieldNUm(TaxInformationVendTable_IN, PanNumber)) { while select RecId , PANNumber , VendTable from tax where tax.VendTable != this.VendTable && tax.PanNumber == this.PaNNumber { if(tax) { ret = false; Info(strFmt("@OAB:OABPanNumberExist",tax.PANNumber,tax.vendtable,VendTable::find(tax.VendTable).vendorName())); } } } return ret; }
Hi Sachin Mittal,
Can you elaborate more on the issue?
You just added info - If you want to allow the user to save the record if the same PAN exist for other records, then ret must return true.
On your code refer to line number 14 - ret buffer must be set to true then only it will allow you to the save the record.
Thanks,
Girish S.
hi , after uisng advice by you , info is printing record two times
You can use the "if" statement to run your logic only if PAN Number is set. If you don't want to fail the validate, don't set ret to false.
For example:
public boolean validateField(FieldId _fieldIdToCheck) { boolean ret = next validateField(_fieldIdToCheck); switch (_fieldIdToCheck) { case fieldNUm(TaxInformationVendTable_IN, PanNumber): if (this.PanNumber) { TaxInformationVendTable_IN tax; while select PANNumber, VendTable from tax where tax.VendTable != this.VendTable && tax.PanNumber == this.PanNumber { info(strFmt("@OAB:OABPanNumberExist", tax.PanNumber, tax.vendTable, VendTable::find(tax.VendTable).vendorName())); } } break; } return ret; }
Info is not printing 2 times - I guess totally 6 vendors has same PAN number as you have given in the form.
no , i have also added screenshot inmf9 , inmf7 ,inmf3 is printing two times
Please debug the code and confirm that the while select you have added is looping 3 times only based on your record.
it is looping 6 times
I am not sure why its looping 6 times. Open "TaxInformationVendTable_IN" in table browser and see how many records against that PAN number - On the table "TaxInformationVendTable_IN" - "Vendor" field is unique. So, I don't think data might not be the issue.
Please review the while select statement you added.
when ret was false it was showing info only one time , when ret is true its showing two times
Why is it in validateField() at all? Will you have the same problem in modifiedField() (which sounds like a better place)?
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 Pallavi Phade 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... 724 Super User 2025 Season 2
Martin Dráb 580 Most Valuable Professional
CA Neeraj Kumar 554