Translate

Saturday, July 5, 2014

Customer Payment Journal using C#



1.       Verify WSDL URI for AccountsReceivableServices under System administration > Setup > Service and Application Integration Framework > Inbound Ports



2.       Add service reference in .Net project.



3.       Add the below code to create customer payment journal.

private void button1_Click(object sender, EventArgs e)
        {
              //Service declarations
            AccountReceivableServices.CallContext callContext = new AccountReceivableServices.CallContext();
            AccountReceivableServices.CustPaymJournalServiceClient client = new AccountReceivableServices.CustPaymJournalServiceClient();
            AccountReceivableServices.AxdCustPaymJournal paymJournal = new AccountReceivableServices.AxdCustPaymJournal();
            AccountReceivableServices.AxdEntity_LedgerJournalTable1 header = new AccountReceivableServices.AxdEntity_LedgerJournalTable1();
            AccountReceivableServices.AxdEntity_LedgerJournalTrans1 trans = new AccountReceivableServices.AxdEntity_LedgerJournalTrans1();

            callContext.Company = "ceu";
            
              //LedgerJournalTable
            header.JournalName = "Pay";
            header.Name = "AIF test";
            header.JournalType = AccountReceivableServices.AxdEnum_LedgerJournalType.CustPayment;
           
              //LedgerJournalTrans
            trans.AccountType = AccountReceivableServices.AxdEnum_LedgerJournalACType.Cust;
            trans.AccountTypeSpecified = true;
            trans.Company = "ceu";
            var account1 = new AccountReceivableServices.AxdType_MultiTypeAccount() { Account = "11101", DisplayValue = "11101" };
            trans.LedgerDimension = account1;
            trans.AmountCurCredit = 22;
            trans.AmountCurCreditSpecified = true;
            trans.OffsetCompany = "ceu";
            trans.PaymMode = "cash";
            header.LedgerJournalTrans = new AccountReceivableServices.AxdEntity_LedgerJournalTrans1[1] { trans };
            paymJournal.LedgerJournalTable = new AccountReceivableServices.AxdEntity_LedgerJournalTable1 [1] { header };
            try
            {
                client.create(callContext, paymJournal);
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }