delete

The delete operation is used to delete an instance of a record. It is similar to the deleteList operation, except that it permits only one record to be deleted per request.

Request

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

Element Name

XSD Type

Notes

recordRef

RecordRef

Indentifies the record 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 delete 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 DeleteResponse type is used for the response. It contains the following fields.

Element Name

XSD Type

Notes

response

WriteResponse

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.

Note:

If you attempt to delete a record that does not exist, the system returns an INVALID_KEY_OR_REF error.

Sample Code

The following example shows how to delete a cash sale transaction.

C#

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

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

   DeletionReason myDeletionReason = new DeletionReason();
   myDeletionReason.deletionReasonCode = myDeletionReasonCode;
   myDeletionReason.deletionReasonMemo = "Per John in Accounting";

   _service.delete(myCashSale, myDeletionReason);

} 

        

SOAP Request

          <soap:Body>
   <delete xmlns="urn:messages_2017_1.platform.webservices.netsuite.com">
      <baseRef type="cashSale" internalId="1745" xsi:type="q1:RecordRef" xmlns:q1="urn:core_2017_1.platform.webservices.netsuite.com"/>
         <deletionReason>
            <deletionReasonCode internalId="3" xmlns="urn:core_2017_1.platform.webservices.netsuite.com"/>
            <deletionReasonMemo xmlns="urn:core_2017_1.platform.webservices.netsuite.com">Per John in Accounting</deletionReasonMemo>
         </deletionReason>
   </delete>
</soap:Body> 

        

SOAP Response

          <soapenv:Body>
   <deleteResponse 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="cashSale" internalId="1745" xmlns:platformCore="urn:core_2017_1.platform.webservices.netsuite.com"/>
      </writeResponse>
   </deleteResponse>
</soapenv:Body> 

        

Related Topics

General Notices