As per the Suite Talk Web Services Platform Guide, the delete operation is used to delete an existing instance of a record in NetSuite. This example will guide developer how to perform a delete operation thru web service using PHPToolkit.
Note: This article requires existing knowledge of Web Services and PHP.
Note: The information contained in this article may or may not lead to the alteration of data in your production account, thus NetSuite holds no liability whether you choose to follow the instructions. In the event that data is deleted, altered or removed and requires restoration there will be applicable fees. Please proceed with caution.
Code snippet that deletes a contact record:
# DELETE CONTACT
//when invoking a delete method it requires a baseRef parameter
$contactDelete = new nsRecordRef(array('type' => 'contact',
'internalId' => '1'));
//assign the result to a writeResponse to extract the result
$writeResponse = $myNSclient->delete($contactDelete);
echo "Success deleted a contact record.";
//display the reason why the request fail
catch (Exception $e)
echo "Unable to delete the contact due to the following error: " . $e;
The above code generates the following SOAP request:
<baseRef type="RecordRef" type="contact" internalId="1"/>
<status isSuccess="true" />
<baseRef type="RecordRef" type="contact" internalId="179" />