Search This Blog

Monday 14 April 2014

Importing customers using AIF (Creating a custom Service) in Dynamics Ax 2012 R2

Hi Guys,

Today i would like to share you how to import customers using AIF(Application Integration Framework ) in Dynamics Ax 2012 R2

Let me explain step by steps,

Step 1: create a new class , Go to properties of the class and change Runon to Server









Step 2: Create a new method createCustomer and type the below code


[SysEntryPointAttribute(true)]
public void createCustomer(AccountNum _custAccount,CustGroupId custGroup,Name _custName,str _currency)
{
    CustCustomerService custService;
    CustCustomer cust;
    CustCustomer_CustTable custTable;
    CustCustomer_DirParty dirParty;
    CustCustomer_DirParty_DirOrganization dirOrg;

    custService=CustCustomerService::construct();

    cust= new CustCustomer();
    custTable = cust.createCustTable().addNew();
    custTable.parmAccountNum(_custAccount);
    custTable.parmCustGroup(custGroup);
    custTable.parmCurrency(_currency);
   

    dirOrg= new CustCustomer_DirParty_DirOrganization();
    dirOrg.parmName(_custName);
    dirOrg.parmLanguageId("en-us");

    custTable.createDirParty().add(dirOrg);

    custService.create(cust);
}


Step 3: Create New Service





Step 4: Add Operation to Service





Step 5: Create new Service Group called CustomerImportServiceGrp



Step 6: Add a New Service Node Reference 









 

Step 7: Deploy the Service Group







Step 8: Check whether a inbound port is created

DAT->System Administrator->Setup-> Services and Application Integration Framework ->Inbound Ports



          
Step 9: Go to Start->All programs-> Microsoft Visual studio 2010->Visual Studio Tools->Visual Studio Command Prompt(2010)
Type wcftestclient



Step 10: Add  Service and paste the WSDL url of CustomerImportServiceGrp from Inbound Port







Step 11: Double click the createCustomer operation and enter the value and  click invoke Button





 The below error occurs if the number sequence for the customer is Continuous change it to Manual





All customers List page before execution of service





 Customer Listpage after the customer is inserted


That's it We have done it ..............

Thanks ,
Banupriya


No comments:

Post a Comment