Basic Searches in SOAP Web Services

See the following topics to learn how to execute a basic search in NetSuite using SOAP web services:

Basic Searches

A basic search lets you search records of a specific type using the fields on that record as search filters. The following figure shows the UI equivalent of a basic Customer search. Start by going to Lists > Relationships > Customers > Search, and ensure that the Use Advanced Search box is not checked. You can specify one or more field values to use as filters for search results.

A basic customer search in the UI.

In a basic search, field criteria are the only values you set. You cannot specify search return columns. In SOAP web services, specifying search return columns is the equivalent of performing an advanced search. (See Advanced Searches in SOAP Web Services for details.)

In the example of a basic Customer search (see previous figure), the results returned include the record ID of every customer that has the Category field set to From Advertisement and the Status field set to Customer-Closed Won. Note that ALL the other data associated with these specific customer records are returned as well. As a consequence, in SOAP web services a basic search tends to increase the search response time.

SOAP Objects Used in a Basic Search

To perform a basic search in which you specify search filter criteria only, use:

  1. < Record > Search

  2. < Record > SearchBasic

For more details, see Basic Search Objects Explained and Basic Search Code Sample.

Basic Search Objects Explained

In SOAP web services, any record that supports search has a corresponding < Record > Search object, which contains a basic element. The basic element references a < Record > SearchBasic object, which defines all available search criteria (filter fields) specific to that record type.

The XSD snippet below shows the CustomerSearch object. The basic element references the CustomerSearchBasic object, which defines all available search criteria for the Customer record.

          <complexType name=" CustomerSearch ">
        <complexContent>
            <extension base="platformCore:SearchRecord">
                <sequence>
                    <element name=" basic " type="platformCommon: CustomerSearchBasic " minOccurs="0"/>
                    <element name="callJoin" type="platformCommon:PhoneCallSearchBasic" minOccurs="0"/>
                    <element name="campaignResponseJoin" type="platformCommon:CampaignSearchBasic"
         minOccurs="0"/>
                 .....
                
      </sequence>
            </extension>
        </complexContent>
    </complexType> 

        
Note:

< Record > Search objects reside in the same XSD as their corresponding record objects. In this case, both the Customer and CustomerSearch objects reside in the listRel XSD. Also note that the CustomerSearch object, like all < Record > Search objects, provide available search joins for that record type. For information on joined searches, see Joined Searches in SOAP Web Services.

This snippet shows the CustomerSearchBasic object. All < Record > SearchBasic objects are defined in the platformCommon XSD. This sample shows four of the available fields (accountNumber, address, addressee, addressLabel) that can be used as search criteria on the Customer record.

          <complexType name=" CustomerSearchBasic ">
      <complexContent>
   <extension base="platformCore:SearchRecord">
      <sequence>
        <element name=" accountNumber " type="platformCore:SearchStringField" minOccurs="0" /> 
        <element name=" address " type="platformCore:SearchStringField" minOccurs="0" /> 
       <element name=" addressee " type="platformCore:SearchStringField" minOccurs="0" /> 
        <element name=" addressLabel " type="platformCore:SearchStringField" minOccurs="0" /> 
               ...
     </sequence>
         </extension>
   </complexContent>
</complexType> 

        
Important:

< Record > SearchBasic does not work for subrecords.

For a code sample of a basic search, see Basic Search Code Sample.

Basic Search Behavior with User Event Scripts and Workflows

If the bodyFieldsOnly preference is set to false, a basic search triggers user event scripts and workflows. To avoid triggering user event scripts and workflows while using basic search, do one of the following:

Related Topics

search
Joined Searches in SOAP Web Services
Advanced Searches in SOAP Web Services
Joining Through Custom Fields
Setting Valid Search Values
Setting the anyof, mine, or myteam Filtering Values
Searching by lastModifiedDate
Understanding Sorting in Advanced Search
Search-Related Sample Code
Searching for a Multi-select Custom Field
Search Issues and Best Practices for SOAP Web Services and SuiteScript

General Notices