Adding a Journal Entry

The following example shows how to create a journal entry record that has two sublist lines.

C#

            private void addJournalEntry()
        {

            JournalEntry newJournalEntry = new JournalEntry();
            newJournalEntry.externalId = "201A";

            RecordRef mySubsidiary = new RecordRef();
            mySubsidiary.internalId = "1";
            newJournalEntry.subsidiary = mySubsidiary;
                        
            RecordRef myCurrency = new RecordRef();
            myCurrency.internalId = "3";
            newJournalEntry.currency = myCurrency;

            newJournalEntry.exchangeRate = .911;
            newJournalEntry.exchangeRateSpecified = true;

            RecordRef myDebitAccount = new RecordRef();
            myDebitAccount.internalId = "7";

            RecordRef myCreditAccount = new RecordRef();
            myCreditAccount.internalId = "8";
                      
            newJournalEntry.lineList = new JournalEntryLineList();
            newJournalEntry.lineList.line = new JournalEntryLine[2];
            
            newJournalEntry.lineList.line[0] = new JournalEntryLine();
            newJournalEntry.lineList.line[0].account = myDebitAccount;
            newJournalEntry.lineList.line[0].debit = 1000;
            newJournalEntry.lineList.line[0].debitSpecified = true;

            newJournalEntry.lineList.line[1] = new JournalEntryLine();
            newJournalEntry.lineList.line[1].account = myCreditAccount;
            newJournalEntry.lineList.line[1].credit = 1000;
            newJournalEntry.lineList.line[1].creditSpecified = true;

            _service.add(newJournalEntry);

        } 

        

SOAP Request

          <soapenv:Body>
   <add xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
      <record xmlns:q1="urn:general_2017_1.transactions.webservices.netsuite.com" xsi:type="q1:JournalEntry" externalId="201A">
         <q1:currency internalId="3" />
         <q1:exchangeRate>0.911</q1:exchangeRate>
         <q1:subsidiary internalId="1" />
         <q1:lineList>
            <q1:line>
               <q1:account internalId="7" />
               <q1:debit>1000</q1:debit>
            </q1:line>
            <q1:line>
               <q1:account internalId="8" />
               <q1:credit>1000</q1:credit>
            </q1:line>
         </q1:lineList>
      </record>
   </add>
</soapenv:Body> 

        

SOAP Response

          <soapenv:Body>
   <addResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
      <writeResponse>
         <platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
         <baseRef internalId="8842" externalId="201A" type="journalEntry" xsi:type="platformCore:RecordRef" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
      </writeResponse>
   </addResponse>
</soapenv:Body> 

        

Related Topics

General Notices