web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Warning Message on Quotation creation if the customer status is stopped

(0) ShareShare
ReportReport
Posted on by 634

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

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    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.

  • D365  beginner Profile Picture
    634 on at

    Thanks a lot Mr. ievgen,

    can I have a sample code for the same ? I am beginner in AX and developments.

  • Verified answer
    Mea_ Profile Picture
    60,284 on at

    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

  • D365  beginner Profile Picture
    634 on at

    Thanks  Mr. ievgen, It works fine.

  • Mea_ Profile Picture
    60,284 on at

    If your issues is solved you can close this thread by marking answer that helped you as verified.

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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans