Example of Adding an Instance of a Journal Custom Transaction Type

The following example shows how to add a custom transaction with two lines. In this example, the custom transaction type has a list style of Journal. For that reason, each sublist line uses either the credit or debit field for the monetary value. Each transaction must have at least one credit line and one debit line, and the lines must balance.

Note that when you create an instance of a journal custom transaction type, the memo body field is not available.

C#

          private void addCustomTransaction()
{ CustomTransaction myCustomTrxn = new CustomTransaction(); myCustomTrxn.externalId = "1055A"; // Create a RecordRef to identify the custom transaction type RecordRef myCustTrxnType = new RecordRef(); myCustTrxnType.type = RecordType.customTransactionType; myCustTrxnType.typeSpecified = true; myCustTrxnType.internalId = "110"; myCustomTrxn.tranType = myCustTrxnType; // If this is a OneWorld account, create a RecordRef to //identify the subsidiary RecordRef mySubsidiary = new RecordRef(); mySubsidiary.internalId = "1"; myCustomTrxn.subsidiary = mySubsidiary; // If the transaction type includes other required body fields, // set values for them. RecordRef myClass = new RecordRef(); myClass.internalId = "6"; myCustomTrxn.@class = myClass; // If the transaction type includes a status field, set a value // for it, as appropriate. Use a RecordRef, and set the internalId // field to the ID value of the status, as shown in the UI on the // Statuses sublist. RecordRef myStatus = new RecordRef(); myStatus.internalId = "A"; myCustomTrxn.tranStatus = myStatus; // Create a sublist and two lines. CustomTransactionLineList myLineList = new CustomTransactionLineList(); myLineList.customTransactionLine = new CustomTransactionLine[2]; myCustomTrxn.lineList = myLineList; myLineList.customTransactionLine[0] = new CustomTransactionLine(); RecordRef myDebitAccount = new RecordRef(); myDebitAccount.type = RecordType.account; myDebitAccount.typeSpecified = true; myDebitAccount.internalId = "6"; myLineList.customTransactionLine[0].account = myDebitAccount; myLineList.customTransactionLine[0].debit = 1600; myLineList.customTransactionLine[0].debitSpecified = true; myLineList.customTransactionLine[1] = new CustomTransactionLine(); RecordRef myCreditAccount = new RecordRef(); myCreditAccount.type = RecordType.account; myCreditAccount.typeSpecified = true; myCreditAccount.internalId = "12"; myLineList.customTransactionLine[1].account = myCreditAccount; myLineList.customTransactionLine[1].credit = 1600; myLineList.customTransactionLine[1].creditSpecified = true; // Add the custom transaction instance. _service.add(myCustomTrxn); } 

        

SOAP Request

          <soap:Body>
   <add xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
      <record externalId="1055A" xsi:type="q1:CustomTransaction" xmlns:q1="urn:customization_2017_1.setup.webservices.netsuite.com">
         <q1:tranType type="customTransactionType" internalId="110"/>
         <q1:tranStatus internalId="A"/>
         <q1:subsidiary internalId="1"/>
         <q1:class internalId="6"/>
         <q1:lineList>
            <q1:customTransactionLine>
               <q1:account type="account" internalId="6"/>
               <q1:debit>1600</q1:debit>
            </q1:customTransactionLine>
            <q1:customTransactionLine>
               <q1:account type="account" internalId="12"/>
               <q1:credit>1600</q1:credit>
            </q1:customTransactionLine>
         </q1:lineList>
      </record>
   </add>
</soap: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 xsi:type="platformCore:RecordRef" type="customTransaction" externalId="1055A" internalId="9676" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
      </writeResponse>
   </addResponse>
</soapenv:Body> 

        

Related Topics

Custom Transaction
Custom Transaction Supported Operations
Custom Transaction Body and Sublist Fields
How List Styles Affect Your Integration
Custom Transaction Code Samples
Example of Getting a Custom Transaction
Example of Adding an Instance of a Basic Custom Transaction Type
How to Use the SOAP Web Services Records Help
SOAP Web Services Supported Records
SOAP Schema Browser
SuiteTalk SOAP Web Services Platform Overview

General Notices