Hi Guys,
I would like to set a validation while creating Sales Quotations that while selecting the customer account it should check the status of the customer account and provide a warning message that the customer status is stopped. (only if they are stopped).
how can I do this ?
*This post is locked for comments
If your issues is solved you can close this thread by marking answer that helped you as verified.
Thanks Mr. ievgen, It works fine.
SalesQuotationTable.validateWrite()
public boolean validateWrite() { ... if ( this.custTable_CustAccount().MyStatus != Status::CorrectStatus) { ret = checkfailed('Incorrect status'); } ... return ret; }
for validate method on SalesCreateQuotation form
public boolean validate() { boolean ret; CustTable custTable = salesQuotationTable.custTable_CustAccount(); ret = super(); if (custTable.mcrMergedParent) { // Warning displayed in validateField on the salesQuotationTable // Return the parent account number salesQuotationTable.CustAccount = custTable.mcrMergedRoot; } //new code ->> if (custTable.MyStatus != Status::CorrectStatus) { ret = checkfailed('Incorrect status'); } //new code <-- return ret; }
You need to choose what better suits your requirements
Thanks a lot Mr. ievgen,
can I have a sample code for the same ? I am beginner in AX and developments.
Hi Alex Antony,
You can add your code to SalesQuotationTableType.validateField() method if you want to validate customer account on creation and update or if you want to do this only on creation you can add it to validate() method on CustAccount field on SalesCreateQuotation form.
Another option is to do the same check on validateWrite() of form data source or table level.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156