deleteList

The deleteList operations is used to delete one or more record instances. The record instances can be of various record types. For example, it is possible to delete a customer and a contact within a single request by using this operation.

Note:

An asynchronous equivalent is available for this operation, asyncDeleteList. For information about asynchronous request processing, see Synchronous Versus Asynchronous Request Processing.

Request

The DeleteListRequest type is used for the request. It contains the following fields.

Element Name

XSD Type

Notes

record[]

RecordRef

An array of recordRef objects that specify the records to be deleted.

deletionReason

DeletionReason

Identifies a deletion reason and deletion reason memo. This parameter supports the Use Deletion Reasons feature, which requires users to provide reasons when they delete transactions. However, even when this feature is not enabled, you must use this parameter with every deleteList request. (You can provide a value of null in such cases.) For more details, see Deletion Reason Usage Notes.

Deletion Reason Usage Notes

Note the following about the deletionReason parameter:

For more details about the Use Deletion Reasons feature, see Recording a Reason for Deleting a Transaction.

Response

The DeleteListResponse type is used for the response. It contains the following fields.

Element Name

XSD Type

Notes

response[]

WriteResponse

Contains an array of WriteResponse objects, each of which contains details on the status of the delete operation and a reference to the deleted record.

Faults

This operation can throw one of the following faults. See SOAP Fault Status Codes for more information on faults.

Sample Code

The following examples show various ways of using the deleteList operation.

C#

The following example shows how to delete two cash sale transactions. Both transactions have the same deletion reason.

          private void deleteCashSales()
{
   RecordRef myCashSale = new RecordRef();
   myCashSale.internalId = "1727";
   myCashSale.type = RecordType.cashSale;
   myCashSale.typeSpecified = true;

   RecordRef myCashSale2 = new RecordRef();
   myCashSale2.internalId = "1728";
   myCashSale2.type = RecordType.cashSale;
   myCashSale2.typeSpecified = true;

   RecordRef myDeletionReasonCode = new RecordRef();
   myDeletionReasonCode.internalId = "2";

   DeletionReason myDeletionReason = new DeletionReason();
   myDeletionReason.deletionReasonCode = myDeletionReasonCode;
   myDeletionReason.deletionReasonMemo = "Per Scott";       

   RecordRef[] myCashSaleRefs = new RecordRef[2];
   myCashSaleRefs[0] = myCashSale;
   myCashSaleRefs[1] = myCashSale2;

   _service.deleteList(myCashSaleRefs, myDeletionReason);

} 

        

The following example shows how to delete two records of different types: an employee record and a calender event record. Because it’s not possible to set a deletion reason for either of those two types of records, the deletion reason used is null.

          private void deleteVariousRecords()
{
   RecordRef myEmployee = new RecordRef();
   myEmployee.internalId = "360";
   myEmployee.type = RecordType.employee;
   myEmployee.typeSpecified = true;

   RecordRef myCalendarEvent = new RecordRef();
   myCalendarEvent.internalId = "381";
   myCalendarEvent.type = RecordType.calendarEvent;
   myCalendarEvent.typeSpecified = true;

   RecordRef[] myRecords = new RecordRef[2];
   myRecords[0] = myEmployee;
   myRecords[1] = myCalendarEvent;

   _service.deleteList(myRecords, null);

} 

        

SOAP Request

The following SOAP request shows how to delete an employee and calendar event record.

          <soap:Body>
   <deleteList xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
      <baseRef type="employee" internalId="360" xsi:type="q1:RecordRef" xmlns:q1="urn:core_2017_1.platform.webservices.netsuite.com"/>
      <baseRef type="calendarEvent" internalId="381" xsi:type="q2:RecordRef" xmlns:q2="urn:core_2017_1.platform.webservices.netsuite.com"/>
   </deleteList>
</soap:Body> 

        

SOAP Response

In the response, the status for each item in the request is returned. If a problem exists with one of the items, creating an error, the other records are still processed.

          <soapenv:Body>
   <deleteListResponse xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
      <writeResponseList>
         <platformCore:status isSuccess="true" xmlns:platformCore="urn:core_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="employee" internalId="360" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
            </writeResponse>
            <writeResponse>
               <platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
               <baseRef xsi:type="platformCore:RecordRef" type="calendarEvent" internalId="381" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
            </writeResponse>
      </writeResponseList>
   </deleteListResponse>
</soapenv:Body> 

        

Related Topics

delete
Recording a Reason for Deleting a Transaction
SuiteTalk SOAP Web Services Platform Overview
SOAP Web Services Development Considerations
SOAP Web Services Processing
SOAP Web Services Operations
SOAP Web Services Standard Operations
SOAP Web Services List Operations
SOAP Web Services Asynchronous Operations

General Notices