28 Mar 2013

How to Copy Sales Quote in 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);

No comments:

Create number sequence in D365 FO

Create the data type. Add code in the loadModule method of the appropriate NumberSeqModule subclass. Add a method to the module’s paramet...