Search This Blog

Thursday, June 25, 2015

AIF Outbound Read ParentAXBC while processingRecord AX2012

Scenario:

In AIF outbound document service Exporting Invoices information,
In this document we have the customization as one table which contains the printTemplates where it stores the printTemplate information like,address,bankdetails,etc.Using this printTemplate number the external system will define which printing report they have to use.
The Requirement is  The Address containes all the street,country,etc. these information we have to generate from translation tables based on the language that defined in the custinvoiceJournal.

so the datasource lookes like this.
custinvoicejour->custinvoicetrans,custTable,etc, as well printTemplateTable also outerjoins to the custinvoicejour.


I didnt find the way where I can get the parentaxbc object while processing the current record.

Solution:
I thought to get parentAXBC object always for the outbound for the current AXBC record.

See the Modification that I have build.


1. AXDBase class
             added the class variable as AXInternalBase parentAXBC;

2. AxdBaseRead class
   Open method serializeRecord add the folllowing line of code above        AXbase.ProccesingRecord(common) line in that method
axdBase.parmParentAxBC(_parentAxBC);

3. AxdBaseGenerateXSD class
   Open this class edit method addDocumentProperties and add one more case for classType as below, so that while serialization class object wont fail.
// added by krishna for to check for class type also. begins
case Types::Class:
if (typename == '')
{
typename = #xsdStringType;
typeNameSpace = #xsdNameSpace ;
}
break;

// added by krishna for to check for class type also.

Now framework was updated to get parentAXBC allways while outbound. now you can write logic whatever you want to use it.


Open AXDSalesInvoice class and update the processing record with the business logic for you to handle.
It this method i am verifying the current record in printTemplate then get the parent and get the languageId from that do my logic.

public void processingRecord(Common common)
{
 PrintTemplate PrintTemplate;
 AxCustInvoiceJour axCustInvoiceJour;
 if(common.TableId == tableNum(PrintTemplate))
 {
 axCustInvoiceJour=this.parmParentAxBC();
 PrintTemplate=common;
 PrintTemplate.CompanyCountryName=LogisticsAddressCountryRegionTranslation::find(LogisticsPostalAddress::findRecId(PrintTemplate.Address).CountryRegionId,axCustInvoiceJour.parmLanguageId()).ShortName;
 super(PrintTemplate);
 }
 else
 {
 super(common);
 }

}


If you guys likes this post and useful please like and share it.

 

No comments:

Post a Comment

Thanks for visiting my blog,
I will reply for your comment within 48 hours.

Thanks,
krishna.