Transaction Search

Nearly all transaction record types use the TransactionSearch record for search. The basic element in this record references the TransactionSearchBasic record, which lists all available search filter fields available in a transaction search.

The TransactionSearch record also lists all search joins available in a transaction search. For details, see the SOAP Schema Browser’s TransactionSearch reference page.

Be aware that the actual search filter fields available will vary depending on the transaction type you are searching against. Not all of the search filter fields defined in TransactionSearchBasic will exist on every single transaction type. For example, the Check transaction type may include search filter fields not available on the Journal Entry type. However, search filters values for both record types will be defined in TransactionSearchBasic.

A TransactionSearchAdvanced request with specified columns returns every tranLine as a record. For example, if a sales order contains 1 item line, search results include up to 3 records, depending on the accounts that are touched. This behavior is the same behavior as transaction search in the UI. By contrast, TransactionSearchBasic, and TransactionSearchAdvanced without specified columns, return the whole transaction record. For example, if a search returns a sales order with 3 item lines, search results consist of one record, with ItemList containing 3 items. These operations return basically the same results as a get() operation.

Note:

The Opportunity and the Time Bill records are the only transaction types that have their own search interfaces. For details, see the SOAP Schema Browser’s OpportunitySearch and TimeBillSearch reference pages.

          // the sales order
RecordRef salesOrderRef = new RecordRef();
salesOrderRef.setInternalId("873");
TransactionSearchBasic tranSearch = new TransactionSearchBasic();
// type is item fulfill
tranSearch.setType( new SearchEnumMultiSelectField( new String [] {RecordType.itemFulfillment.getValue()}, SearchEnumMultiSelectFieldOperator.anyOf));
// created from our sales order
tranSearch.setCreatedFrom( new SearchMultiSelectField( new RecordRef [] { salesOrderRef }, SearchMultiSelectFieldOperator.anyOf));
SearchResult result = c.search(tranSearch); 

        
          //And the outgoing search SOAP looks like this:
<search xmlns="urn:messages_2017_1.platform.webservices.netsu ite.com"> 
<searchRecord xsi:type="ns1:TransactionSearchBasic" xmlns:ns1="urn:common_2017_1.platform.webservices.netsuite.com"> 
<ns1:createdFrom operator="anyOf" xsi:type="ns2:SearchMultiSelectField" xmlns:ns2="urn:core_2017_1.platform.webservices.netsuite.com"> 
<ns2:searchValue internalId="873" xsi:type="ns2:RecordRef"/> 
</ns1:createdFrom> 
<ns1:type operator="anyOf" xsi:type="ns3:SearchEnumMultiSelectField" xmlns:ns3="urn:core_2017_1.platform.webservices.netsuite.com"> 
<ns3:searchValue xsi:type="xsd:string">itemFulfillment</ns3:searchValue> 
</ns1:type> 
</searchRecord> 
</search> 

        
Important:

By default only a record's body fields are returned on a search. Therefore, you must set the bodyFieldsOnly element of the SearchPreferences type to false if you want to also return the information specified on a record's sublist. For general information on searching in SOAP web services, see search.

Usage Notes

The following transaction searches are not supported in SOAP web services:

Sample Code

The following sample returns three records, including one that was modified within two minutes the search was made.

SOAP Request

           <soapenv:Body>
 <search xmlns="urn:messages_2017_1.platform.webservices.netsu ite.com">
 <searchRecord xsi:type="ns9:TransactionSearchBasic" xmlns:ns9="urn:common_2017_1.platform.webservices.netsuite.com">
 <ns9:lastModifiedDate operator="onOrAfter" xsi:type="ns10:SearchDateField" xmlns:ns10="urn:core_2017_1.platform.webservices.nets uite.com">
<ns10:predefinedSearchValue xsi:type="ns11:SearchDate" xmlns:ns11="urn:types.core_2017_1.platform.webservices.netsuite.com">today</ns10:predefinedSearchValue>
</ns9:lastModifiedDate>
 <ns9:type operator="anyOf" xsi:type="ns12:SearchEnumMultiSelectField" xmlns:ns12="urn:core_2017_1.platform.webservices.netsuite.com">
<ns12:searchValue xsi:type="xsd:string">_salesOrder</ns12:searchValue>
</ns9:type>
</searchRecord>
</search>
</soapenv:Body> 

        

Java

          TransactionSearchBasic basic = new TransactionSearchBasic();
 
SearchEnumMultiSelectField soType = new SearchEnumMultiSelectField();
soType.setSearchValue(new String[1]);
soType.setSearchValue(0, TransactionType.__salesOrder);
soType.setOperator(SearchEnumMultiSelectFieldOperator.anyOf);
basic.setType(soType);
 
SearchDateField todayLastMod = new SearchDateField();
todayLastMod.setOperator(SearchDateFieldOperator.o nOrAfter);
todayLastMod.setPredefinedSearchValue(SearchDate.t oday);
 
basic.setLastModifiedDate(todayLastMod); 

        

Related Topics

General Notices