Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Warning Message on Quotation creation if the customer status is stopped

Posted on by 572

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

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Warning Message on Quotation creation if the customer status is stopped

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

  • D365  beginner Profile Picture
    D365 beginner 572 on at
    RE: Warning Message on Quotation creation if the customer status is stopped

    Thanks  Mr. ievgen, It works fine.

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Warning Message on Quotation creation if the customer status is stopped

    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
    D365 beginner 572 on at
    RE: Warning Message on Quotation creation if the customer status is stopped

    Thanks a lot Mr. ievgen,

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

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Warning Message on Quotation creation if the customer status is stopped

    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.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans