Sales and Purchase Custom Transaction Types in Integrations

Sales and purchase custom transaction types can be used in CSV imports and are available in various areas of NetSuite. To learn more about sales and purchase custom transaction types in integrations, see the following sections.

Sales and Purchase Custom Transaction Types CSV Import

The CSV Import Assistant can be used to import sales and purchase custom transactions. For more information about how to import custom transactions, see Custom Transactions Import.

Sales and Purchase Custom Transaction Types in SuiteScript

Sales and purchase custom transactions are also available in SuiteScript. For more information about custom transactions through SuiteScript, see Custom Transaction.

Sales and Purchase Custom Transaction Types in SOAP Web Services

Sales and purchase custom transaction types are also available in SOAP web services. As sales and purchase custom transactions in SOAP web services differ in a few things from other custom transaction types, it is important to read through the whole topic.

You can also find more information in Sales and Purchase Transaction Types Overview.

You can find more information about Custom Transactions in SOAP web services in Custom Transaction.

Supported Operations

The following operations can be used with the sales and purchase custom transaction types:

add | addList | attach / detach | delete | deleteList | get | getCustomizationId | getDeleted | getList | getSavedSearch | getSelectValue | initialize / initializeList | search | update | updateList | upsert | upsertList |

Note:

You can also use the asynchronous equivalents of SOAP web services list operations. For information about asynchronous operations, see SOAP Web Services Asynchronous Operations. For more information about request processing, see Synchronous Versus Asynchronous Request Processing.

Field Definitions

 The SuiteTalk Schema Browser includes definitions for all body fields, sublist fields, search filters, and search joins available to this record. For details, see the Schema Browser’s CustomSale and CustomPurchase reference pages.

Note:

For information about using the SuiteTalk Schema Browser, see SOAP Schema Browser.

Usage Notes

Consider the following information when you work with sales and purchase custom transactions:

  • When working with the add, update and upsert operations you must specify a custom transaction type in the tranType field. You can use either the scriptId or the internalId of the specific custom transaction type. Sales and purchase custom transaction types have dedicated classes customSale and customPurchase respectively.

  • For the get, getList, delete, deleteList and attach / detach operations, you must use CustomTransactionRef.

  • When using any search operation, you must search as for any other custom transaction and then set the criteria to sale or purchase.

  • With the initialize operation you can do the following transformations:

    • CustomSale transaction type to another customSale transaction type.

    • CustomSale transaction type to customerPayment.

    • CustomSale transaction type to customerRefund.

    • Invoice to customSale transaction type.

    • SalesOrder to customSale transaction type.

    • CustomPurchase transaction type to another customPurchase transaction type.

  • When using the get operation for a record created through the initialize operation, the returned record does not contain the createdFrom field.

    Note:

    The createdFrom field is usually returned with a record created by the initialize operation and contains the internal id of the source record specified by the element reference

Code Sample

In the following example the add operation is used for a sales custom transaction.

Java

                CustomSaleItem item = new CustomSaleItem();
 item.setItem(createRecordRef("39"));
 
CustomSaleItemList itemList = new CustomSaleItemList();
 itemList.setItem(new CustomSaleItem[] {item});
 
CustomSale record = new CustomSale();
 record.setTranType(createRecordRef("105"));
 record.setEntity(createRecordRef("84"));
 record.setLocation(createRecordRef("2"));
 record.setItemList(itemList);
 
c.addRecord(record); 

              

SOAP Request

                <add xmlns="urn:messages_2019_2.platform.webservices.netsuite.com"> 
  <record xsi:type="ns7:CustomSale" xmlns:ns7="urn:customization_2019_2.setup.webservices.netsuite.com"> 
    <ns7:tranType internalId="105" xsi:type="ns8:RecordRef" xmlns:ns8="urn:core_2019_2.platform.webservices.netsuite.com"/> 
    <ns7:entity internalId="84" xsi:type="ns9:RecordRef" xmlns:ns9="urn:core_2019_2.platform.webservices.netsuite.com"/> 
    <ns7:location internalId="2" xsi:type="ns10:RecordRef" xmlns:ns10="urn:core_2019_2.platform.webservices.netsuite.com"/> 
    <ns7:itemList replaceAll="false" xsi:type="ns7:CustomSaleItemList"> 
      <ns7:item xsi:type="ns7:CustomSaleItem"> 
        <ns7:item internalId="39" xsi:type="ns11:RecordRef" xmlns:ns11="urn:core_2019_2.platform.webservices.netsuite.com"/> 
      </ns7:item> 
    </ns7:itemList> 
  </record> 
</add> 

              

SOAP Response

                <addResponse xmlns="urn:messages_2019_2.platform.webservices.netsuite.com"> 
  <writeResponse> 
    <platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> 
      <platformCore:statusDetail> 
        <platformCore:afterSubmitFailed>false</platformCore:afterSubmitFailed> 
      </platformCore:statusDetail> 
    </platformCore:status> 
    <baseRef internalId="176" type="customSale" xsi:type="platformCore:RecordRef" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"/> 
  </writeResponse> 
</addResponse> 

              

In the following example the initialize operation is used to transform a purchase custom transaction type 76 to a purchase custom transaction type 105.

Java

                InitializeRef reference = new InitializeRef(); reference.setInternalId("76"); reference.setType(InitializeRefType.customPurchase); InitializeAuxRef auxReference = new InitializeAuxRef(); auxReference.setType(InitializeAuxRefType.tranType); auxReference.setScriptId("custompurchase105"); // or auxReference.setInternalId("105"); InitializeRecord initializeRecord = new InitializeRecord(); initializeRecord.setType(InitializeType.customPurchase); initializeRecord.setReference(reference); initializeRecord.setAuxReference(auxReference); CustomPurchase recordToAdd = (CustomPurchase) c.initialize(initializeRecord); 

              

SOAP Request

                <initialize xmlns="urn:messages_2019_2.platform.webservices.netsuite.com"> <initializeRecord> <ns7:type xmlns:ns7="urn:core_2019_2.platform.webservices.netsuite.com">customPurchase</ns7:type> <ns8:reference internalId="76" type="customPurchase" xmlns:ns8="urn:core_2019_2.platform.webservices.netsuite.com"/> <ns9:auxReference scriptId="custompurchase105" type="tranType" xmlns:ns9="urn:core_2019_2.platform.webservices.netsuite.com"/> </initializeRecord>
</initialize> 

              

SOAP Response

                <readResponse> <platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"/> <record xsi:type="setupCustom:CustomPurchase" xmlns:setupCustom="urn:customization_2019_2.setup.webservices.netsuite.com"> <setupCustom:createdDate>2019-09-10T07:08:00.000-07:00</setupCustom:createdDate> <setupCustom:lastModifiedDate>2019-09-10T07:08:00.000-07:00</setupCustom:lastModifiedDate> <setupCustom:tranType internalId="105" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>my Purchase B</platformCore:name> </setupCustom:tranType> <setupCustom:billAddressList internalId="38" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>Default Billing</platformCore:name> </setupCustom:billAddressList> <setupCustom:account internalId="6" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>Fees Receivable</platformCore:name> </setupCustom:account> <setupCustom:entity internalId="105" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>Acme Medical Supply</platformCore:name> </setupCustom:entity> <setupCustom:subsidiary internalId="1" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>Parent Company</platformCore:name> </setupCustom:subsidiary> <setupCustom:postingPeriod internalId="353" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>Sep 2019</platformCore:name> </setupCustom:postingPeriod> <setupCustom:tranDate>2019-09-10T00:00:00.000-07:00</setupCustom:tranDate> <setupCustom:currencyName>US USD</setupCustom:currencyName> <setupCustom:billingAddress xmlns:platformCommon="urn:common_2019_2.platform.webservices.netsuite.com"> <platformCommon:country>_unitedStates</platformCommon:country> <platformCommon:addressee>Acme Medical Supply</platformCommon:addressee> <platformCommon:addr1>1234 Sepulveda Blvd</platformCommon:addr1> <platformCommon:city>Los Angeles</platformCommon:city> <platformCommon:state>CA</platformCommon:state> <platformCommon:zip>94321</platformCommon:zip> <platformCommon:addrText>Acme Medical Supply1234 Sepulveda BlvdLos Angeles CA 94321</platformCommon:addrText> <platformCommon:override>false</platformCommon:override> </setupCustom:billingAddress> <setupCustom:exchangeRate>1.0</setupCustom:exchangeRate> <setupCustom:dueDate>2019-09-10T00:00:00.000-07:00</setupCustom:dueDate> <setupCustom:paymentHold>false</setupCustom:paymentHold> <setupCustom:memo>tralala memo</setupCustom:memo> <setupCustom:currency internalId="1" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>US USD</platformCore:name> </setupCustom:currency> <setupCustom:transactionNumber>To Be Generated</setupCustom:transactionNumber> <setupCustom:expenseList> <setupCustom:expense> <setupCustom:line>1</setupCustom:line> <setupCustom:category internalId="2" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>Entertainment</platformCore:name> </setupCustom:category> <setupCustom:account internalId="59" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>Advertising</platformCore:name> </setupCustom:account> <setupCustom:amount>123.0</setupCustom:amount> <setupCustom:isBillable>false</setupCustom:isBillable> </setupCustom:expense> </setupCustom:expenseList> <setupCustom:accountingBookDetailList xmlns:platformCommon="urn:common_2019_2.platform.webservices.netsuite.com"> <platformCommon:accountingBookDetail> <platformCommon:accountingBook internalId="2" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>Secondary accounting book</platformCore:name> </platformCommon:accountingBook> <platformCommon:currency internalId="1" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>US USD</platformCore:name> </platformCommon:currency> <platformCommon:exchangeRate>1.0</platformCommon:exchangeRate> </platformCommon:accountingBookDetail> <platformCommon:accountingBookDetail> <platformCommon:accountingBook internalId="3" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>Third accounting book</platformCore:name> </platformCommon:accountingBook> <platformCommon:currency internalId="1" xmlns:platformCore="urn:core_2019_2.platform.webservices.netsuite.com"> <platformCore:name>US USD</platformCore:name> </platformCommon:currency> <platformCommon:exchangeRate>1.0</platformCommon:exchangeRate> </platformCommon:accountingBookDetail> </setupCustom:accountingBookDetailList> </record>
</readResponse> 

              

Related Topics

Custom Transactions Import
Custom Transaction
Custom Transaction
Sales and Purchase Transaction Types Overview
Sales and Purchase Functionality Available in Custom Transactions
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