getDeleted

You use the getDeleted operation to retrieve a list of deleted records. When you use this operation, you can filter by record type, by script ID, and by the date of record deletion. For each record that matches the filter criteria, the system returns the following data:

The getDeleted operation can be useful when you want to synchronize information in a client application with NetSuite. For example, an Outlook client application plug-in maintains a list of contacts and synchronizes that list with NetSuite. The getDeleted operation can be used to determine contact deletions since the last synchronization with NetSuite.

Permissions

By default, only account administrators and users with the Full Access role have permission to use the getDeleted operation. However, you can grant permission to other roles. To use the getDeleted operation, the role has to have the Deleted Records permission (and the Web Services permission).

Users who have the Deleted Records permission can access results about any type of record that was deleted, even if they do not have permission to create or modify that record type. They also have permission to use the Deleted Record search type in the user interface, unless the Web Services Only option has been selected for the role.

You can give a role the Deleted Records permission by going to Setup > Users/Roles > Manage Roles. Go to the Permissions > Setup subtab, and add a line for the permission.

Usage Notes

Note the following:

Request

The GetDeletedRequest type is used for the request.

Element Name

XSD Type

Notes

getDeletedFilter

GetDeletedFilter

See GetDeletedFilter.

pageIndex

xsd: int

Use this argument to specify which page of results to return in your response. If there is only one page of results, enter 1.

GetDeletedFilter

The GetDeletedFilter lets you retrieve data based on the date, record type, and script ID of the deleted records.

Element Name

XSD Type

Notes

deletedDate

SearchDateField

The date that the record was deleted. For example, you can search for records that were deleted since a particular date or between two dates.

type

SearchEnumMultiSelectField

The type of the record that was deleted. For a complete list of all of the values currently supported by the getDeleted operation, refer to the DeletedRecordType enumerations in the coreTypes XSD.

scriptID

SearchStringField

The scriptID identifying the specific custom record or custom transaction type. Use this field to narrow the results to custom records (or custom transactions) only of that particular type. If you do not specify a script ID, and rely only on the type field, the operation returns details on all instances that were deleted, regardless of type.

Response

The DeletedRecord type is used for the response.

Element Name

XSD Type

Notes

status

Status

The status for this operation. All applicable errors or warnings are listed within this type.

totalRecords

xsd: int

The total number of records that meet the filter criteria.

pageSize

xsd: int

The total number of records listed on each page of the results.

totalPages

xsd: int

The total number of available pages.

pageIndex

xsd: int

The number identifying the current page of results.

deletedRecordList

deletedRecordList

A list of records that meet the filter criteria

Faults

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

Sample Code

The following sample shows how to retrieve details about deleted instances of a custom record type with the script ID customrecord1. It specifies that 10 results should be returned per page, and it includes logic to retrieve all pages.

Java

          {
   c.setSearchPrefsPageSize(10);

   GetDeletedFilter filter = new GetDeletedFilter();
   filter.setType(new SearchEnumMultiSelectField(new String[] {DeletedRecordType._customRecord}, SearchEnumMultiSelectFieldOperator.anyOf));
   filter.setScriptId(new SearchStringField("customrecord1", SearchStringFieldOperator.is));

   GetDeletedResult result;
      int i = 1;
      do
      {
         result = c.m_port.getDeleted(filter, i);
         if (i == 1)
         {
            System.out.println(String.format("Page Size : %d, Total Pages : %d, Total Records : %d", result.getPageSize(), result.getTotalPages(), result.getTotalRecords()));
         }
         processDeletedRecordList(result.getDeletedRecordList());
         System.out.println(String.format("Current Page Index : %d", result.getPageIndex()));
         i++;
      }
      while (i <= result.getTotalPages());
} 

        

Related Topics

Searching for Deleted Records
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