The formletter
framework in Microsoft Dynamics AX is used when posting documents for sales or
purchase orders. The framework has been refactored in Microsoft Dynamics AX
2012 to provide better support for customizations, extensibility, and
performance.
If you have to
create new custom field in Purchase order and required
flow it to all table
as FormLetter work. Follow these steps.
Create new field let
say 'Remarks' in following tables.
- PurchTable
- VendInvoiceInfoTable
- VendInvoiceJour
- PurchParmTable
Add
an assignment for your new field in
VendInvoiceJour Table Method 'initFromPurchTable'
this.Remarks = PurchTable.Remarks;
Now
create abstract class in AXVendDocumentTableMap class
public
abstract Name parmRemarks(Name _remarks = '')
{
}
After
this you will need to create two method in VendDocumentTableType classs
As
shown below.
protected
Name determineDefaultRemarks()
{
Name remarks;
remarks = this.purchTable().Remarks;
return remarks;
}
protected
void defaultRemarks()
{
Name remarks;
;
if
(!this.axVendDocumentTableMap().isTableFieldSet(fieldnum(VendDocumentTableMap,
Remarks)))
{
remarks =
this.determineDefaultRemarks();
this.axVendDocumentTableMap().parmRemarks(remarks);
}
}
Now
register new field in 'VendDocumentTableMap' TableMap and create its mapping in PurchParmTable and
VendInvoiceInfoTable.
Finally
add an assignment in PurchFormLetterParmData class as shown below.
parmTable.Remarks= localPurchTable.Remarks;
This comment has been removed by the author.
ReplyDeleteHi Farhan, in which method inside the PurchFromLetterParmData the assignment of parmTable.Remarks= localPurchTable.Remarks should be written?
ReplyDelete