Suppress Native Messaging of Credit Limit Exceed

How to suppress native messaging of Credit Limit on a specific sales order 

The credit limit is specified on customer to set the maximum amount of credit. It is checked automatically on different processes. 


If the 'credit remaining' is a negative amount it means that the credit limit is exceeded.

And when the credit limit exceeds it shows an error message or warning based on the credit limit parameters. When the 'check credit limit on sales order' parameter is set to yes and the 'Credit limit type' is not set to 'none', then it checks the credit limit on every sales order and throws an error or warning depending on the parameter 'Message when exceeding credit limit'.

path: Credit and collections > Setup> Credit and collection parameters

If we want to suppress that message on some particular sales orders of our choice not all of them, then we have to add a radio button on the sales order header form. Based on that radio button we will suppress the credit-exceeding message of our sales order.
[Note: if the parameter 'Check credit limit on sales order' is set to 'Nothen this error message will not pop up on any sales order.] 



Now, for stopping the message extending the CustCreditLimit class. 
And extending the setShouldDisplayMessage() method and writing code based on our radio button setting the display message.

/// <summary>
/// Extension of class <c>CustCreditLimit</c>
/// </summary>
[ExtensionOf(classStr(CustCreditLimit))]
final void CustCreditLimit_Extension
{

/// <summary>
/// This method sets the display message to false if the Exclude equipment from credit management is checked.
/// </summary>

    protected void setShodDisplayMessage()
    {
        CredManParameters       credManParameters;
        CustCreditLimit_SalesTable    custCreditLimit_SalesTable;
        SalesTable       salesTable;

        next setShouldDisplayMessage();

        // Not display the message if 'Exclude equipment from credit management' is enabled.
        if (this.GetType().Name = classStr(custCreditLimit_SalesTable))
        {
            custCreditLimit_SalesTable = this;
            salesTable = custCreditLimit_SalesTable.parmsalestable();

            if (SalesTable.ExcludeSalesFromCreditManagement)
    {
        displayMessage = false;
        }
        }
    }
}










Comments

Popular posts from this blog

Batch jobs stuck on WAITING status in AX 2012

Electronic Reporting For Beginners

Computed column and virtual field in D365