Example of Adding an Instance of a Basic 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 Basic. For that reason, each sublist line uses the amount field for the monetary value.

C#

          private void addCustomTransaction()
{ CustomTransaction myCustomTrxn = new CustomTransaction(); myCustomTrxn.externalId = "1052A"; // Create a RecordRef to identify the custom transaction type RecordRef myCustTrxnType = new RecordRef(); myCustTrxnType.type = RecordType.customTransactionType; myCustTrxnType.typeSpecified = true; myCustTrxnType.internalId = "109"; 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; // Create a sublist and add two lines. CustomTransactionLineList myLineList = new CustomTransactionLineList(); myLineList.customTransactionLine = new CustomTransactionLine[2]; myCustomTrxn.lineList = myLineList; myLineList.customTransactionLine[0] = new CustomTransactionLine(); RecordRef myAccount = new RecordRef(); myAccount.type = RecordType.account; myAccount.typeSpecified = true; myAccount.internalId = "9"; myLineList.customTransactionLine[0].account = myAccount; myLineList.customTransactionLine[0].amount = 1000; myLineList.customTransactionLine[0].amountSpecified = true; myLineList.customTransactionLine[1] = new CustomTransactionLine(); RecordRef myAccount2 = new RecordRef(); myAccount2.type = RecordType.account; myAccount2.typeSpecified = true; myAccount2.internalId = "10"; myLineList.customTransactionLine[1].account = myAccount2; myLineList.customTransactionLine[1].amount = 2000; myLineList.customTransactionLine[1].amountSpecified = 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="1053A" xsi:type="q1:CustomTransaction" xmlns:q1="urn:customization_2017_1.setup.webservices.netsuite.com">
         <q1:tranType type="customTransactionType" internalId="109"/>
         <q1:subsidiary internalId="1"/>
         <q1:lineList>
            <q1:customTransactionLine>
               <q1:account type="account" internalId="9"/>
               <q1:amount>1000</q1:amount>
            </q1:customTransactionLine>
            <q1:customTransactionLine>
               <q1:account type="account" internalId="10"/>
               <q1:amount>2000</q1:amount>
            </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="1053A" internalId="9579" 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 Journal 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