Sunday, May 5, 2019

C# > Performing an TransactionSearchAdvanced from an existing saved search using the search operation and displaying the total number of records returned.

Below is sample code to perform a TransactionSearchAdvanced from an existing saved search using the search Operation. Please note this will require a valid login session. Please note this operation is successful with using the WSDL prior to 2013.2.

Status s = nss.login(passport).status;
if (s.isSuccess == true)
{
 // Creating the TransactionSearchAdvanced Object and assigning the saved search id to the object.
 TransactionSearchAdvanced tsa = new TransactionSearchAdvanced();
 
 // Passing the ID of the saved search that exists in NetSuite.
 tsa.savedSearchScriptId = "customsearch7";
 
 // Passing the TransactionSearchAdvanced object to the NetSuiteService Object.
 SearchResult sr = nss.search(tsa);
 
 //Displaying the number of records return if the search was successful.
 if (sr.status.isSuccess)
 {
  Console.Write(sr.totalRecords);
  Console.Read();
 }

}

No comments:

Post a Comment