Thursday, March 10, 2011

Allowing Users to Copy of a Lost or Sent Quote - Microsoft Dynamics AX 2009

The default functionality of Microsoft Dynamics Ax 2009 does not allow to copy a quote when a quote's status is either Lost, Sent, Confirmed, or Canceled.

Today I was asked to allow the users to copy a quote when its status is Sent or Lost.

To copy a quote go to Sales Quotation Details, choose a record and then go to the header level buttons and click Function > CopyFromAll



The following are the steps to accomplish this very quick:



1- Go to the SalesQuotationTable Form > Designs > Design GroupTable> ButtonGroup:ButtonHeader> MenuButton:ButtonHeaderFunction>method>clicked:

You will see the following code:

void  clicked()
{
    ;
    // Set price simulation buttons

    salesQuotationPriceSimHeader.enabled(!salesQuotationTable.isTemplate());

    salesQuotationTableForm.enableFunctionButtons(salesQuotationTable,
                                                  buttonConvert2Customer,
                                                  buttonAlternativeQuotations,
                                                  buttonCopyAllHeader,
                                                  salesQuotationChangeReasonCode);

    smmDocuments.enabled(!salesQuotationTable.isTemplate());
    super();
}

2- Go to the definition of enableFunctionButtons method (right click > Go To Definition.

Look for the following line of code:


enableCopyAllHeaderButton           = salesQuotationTableType.mayQuotationBeCopied();

   
3- Go to the definition of the salesQuotationTableType.mayQuotationBeCopied() method, and then make the following changes:

ok = (//salesQuotationTable.QuotationStatus   != SalesQuotationStatus::Sent &&
            salesQuotationTable.QuotationStatus != SalesQuotationStatus::Confirmed &&
            //salesQuotationTable.QuotationStatus != SalesQuotationStatus::Lost &&
            salesQuotationTable.QuotationStatus != SalesQuotationStatus::Cancelled);

Comment the lines in green.

No comments:

Post a Comment

Thank you for your thoughts. Your comment will appear in my blog shortly after review.

Have a great day!