My task was to set the Print Confirmation check box enable property set to false and to set the value of the Reason drop down list to "New Sales Order". A best practice for AX 2009 is to create this logic directly in the Form methods or Tables, rather than setting fields through MorphX.
I decided to do this in the Form Methods by modifying the following methods (New code will have a comment Earias - Date):
1- Class Declaration: Here I added the Extended Data Type named smmQuotationReasonId and the Table smmQuotationReasonGroup as shown:
class FormRun extends ObjectRun2- Modified the initParameters method: Here I added an instance of the Check Box control as an object and I set the Enabled and Checked properties to false.
{
#resAppl
#localMacro.maxControl 10 #endMacro
SalesQuotationEditLinesForm salesQuotationEditLinesForm;
SalesQuotationTable salesQuotationTable;
Num parmId;
Dialog dialog;
NoYes printFormletterChoice;
//Earias - 2/2/2011
smmQuotationReasonId reasonId;
smmQuotationReasonGroup _smmQuotationReasonGroup;
}
I also instantiated the salesQuotationEditLinesForm with the parameters from the Run Base form as shown below:
void initParameters()I'm trying to think on a better way to create the select statement without having to hard code the New Sales Order value directly into it. I thought on a Enum Value.
{
;
//Earias - 2/2/2011********************************************************************
//Don't allow the user to print the Sales Quotation Confirmation as they can do it from
//the Printout button.
printFormletter.enabled(false);
printFormletter.checked(false);
//Disable the automatic checked of the control PrintFormLetter**************************
//printFormletter.value(salesQuotationEditLinesForm.printFormLetter());
//usePrintManagement.value(salesQuotationEditLinesForm.usePrintManagement());\
//**************************************************************************************
if (salesQuotationEditLinesForm.reasonCode())
reasonCode.text(salesQuotationEditLinesForm.reasonCode());
else
{
salesQuotationEditLinesForm = element.args().caller().runbase(); if(salesQuotationEditLinesForm)
{
switch(salesQuotationEditLinesForm.callerModuleAxapta()) {
case (ModuleAxapta::SalesOrder) :
select ReasonId from _smmQuotationReasonGroup where
_smmQuotationReasonGroup.dataAreaId == 'ago' &&
_smmQuotationReasonGroup.ReasonId == 'New Sales Order';
reasonId = _smmQuotationReasonGroup.ReasonId;
reasonCode.text(reasonId);
break;
}
}
else
reasonCode.text("");
}
//End Earias - 2/2/2011******************************************************************
transferHours2Forecast.value (salesQuotationEditLinesForm.transferHours2Forecast());
transferExpenses2Forecast.value(salesQuotationEditLinesForm.transferExpenses2Forecast());
transferFees2Forecast.value (salesQuotationEditLinesForm.transferFees2Forecast());
transferItems2Forecast.value (salesQuotationEditLinesForm.transferItems2Forecast());
}
I actually realized that I could use the following:
ReplyDelete_smmQuotationReasonId = smmQuotationReasonGroup::find('New Sales Order').ReasonId;
Also, I will add a new field in the table smmQuotationReasonGroup that will allow me to better narrow down the oprions of these tables given our business process.
This is a nice article..
ReplyDeleteIts easy to understand ..
And this article is using to learn something about it..
c#, dot.net, php tutorial, Ms sql server
Thanks a lot..!
ri80