Skip to main content

Create Customer by Code in Ax 2012


This is a Code to create Customer in Axapta 2012. You can try below code in job.

 custTable _custTable;  
 numberSeq _numberSeq;  
 name _name ='Test Customer';  
 dirParty _dirParty;  
 dirPartyPostalAddressView _dirPartyPostalAddressView;  
 dirPartyContactInfoView _dirPartyContactInfo;  
 ;  
 _custTable.initValue();  
 _numberSeq = _numberSeq::newGetNum(CustParameters::numRefCustAccount());  
 _custTable.AccountNum = _numberSeq.num();  
 _custTable.CustGroup ='CG';  
 _custTable.Currency ='INR';  
 _custTable.PaymTermId ='01';  
 _custTable.PaymMode ='CHQ1';  
 _custTable.insert(dirPartyType::Organization, _name);  
 _dirParty = dirParty::constructFromCommon(_custTable);  
 _dirPartyPostalAddressView.Location_name ='TT ';  
 _dirPartyPostalAddressView.City ='SS';  
 _dirPartyPostalAddressView.Street ='TTS';  
 _dirPartyPostalAddressView.StreetNumber ='23';  
 _dirPartyPostalAddressView.CountryRegionId ='DFD';  
 _dirPartyPostalAddressView.State ='DE';  
 _dirParty.createOrUpdatePostalAddress(_dirPartyPostalAddressView);  
 _dirPartyContactInfo.Location_name ='T';  
 _dirPartyContactInfo.Locator ='424234234';  
 _dirPartyContactInfo.Type = LogisticsElectronicAddressMethodType::Phone;  
 _dirPartyContactInfo.IsPrimary = NoYes::Yes;  
 _dirParty.createOrUpdateContactInfo(_dirPartyContactInfo);  

Popular posts from this blog

sales order Totals option getting error in Axapta

Problem: On  click sales order Totals option getting below error. Please help me how to solve it. Microsoft.Dynamics.Ax.Xpp.ClrErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ClrErrorException' was thrown. at Microsoft.Dynamics.Ax.Xpp.CLRInterop.MakeReflectionCall(Object instance, String methodName, Object[] parameters) at Dynamics.Ax.Application.TaxDocumentProxy.Sumbytaxaccountingprovider(TaxAccountingProvider taxAccountingProvider, TaxAcctPostingProfDistributionSide postingSide, String taxType, String taxComponent, Boolean , Boolean , Boolean ) in TaxDocumentProxy.sumByTaxAccountingProvider.xpp:line 15 at Dynamics.Ax.Application.TaxDocumentProxy.@Sumbytaxaccountingprovider(TaxAccountingProvider taxAccountingProvider, TaxAcctPostingProfDistributionSide postingSide, String _taxType, Boolean , Boolean ) at Dynamics.Ax.Application.TaxDocumentProxy.@Sumbytaxaccountingprovider(TaxAccountingProvider taxAccountingProvider, TaxAcctPostingProfDistributionSide postingSide, ...

X++ Code to run SSRS Report with parameter in D365 F&O (Example Sales Invoice )

Below is sample X++ Code to run SSRS Report with parameter in D365 F&O (Example Sales Invoice )      Args                       args = new Args();     CustInvoiceJour            custInvoiceJour;     SalesInvoiceJournalPrint   salesInvoiceJournalPrint;       select firstonly custInvoiceJour where custInvoiceJour.SalesId != '';       // Add record to be printed.     // In order to have the context table we need to set args.record().     args.record(custInvoiceJour);       salesInvoiceController = new SalesInvoiceController();     salesInvoiceController.parmReportName(         PrintMgmtDocType::construct(PrintMgmtDocumentType::SalesOrderInvoice).getDefaultReportFormat());       salesInvoiceContract = salesInvoiceController.parmReportContrac...