Saturday, May 4, 2019

C# > Performing ItemSearchAdvanced and returning the ID's of the Items.

Below is sample code on how to perform an ItemSearchAdvanced and only return the ID of each Item. Please note you will need a valid Login Session. Also Items will need to exist in your account in order to pull these Items.

Status stat = nss.login(p).status;
if (stat.isSuccess == true)
 // Creating the objects needed for the ItemSearchAdvanced
 ItemSearchAdvanced isa = new ItemSearchAdvanced();
 ItemSearchRow isr = new ItemSearchRow();
 ItemSearchRowBasic isrb = new ItemSearchRowBasic();

 //Creating the custom column to return the ID's
 SearchColumnSelectField[] scsf = new SearchColumnSelectField[1];
 SearchColumnSelectField scsf1 = new SearchColumnSelectField();
 scsf1.customLabel = "id";
 scsf[0] = scsf1;
 //Assigning the variables to the required objects.
 isrb.internalId = scsf;
 isr.basic = isrb;
 isa.columns = isr;
 // Passing the search to the NetSuiteService Object.
 SearchResult sr = new SearchResult();
 sr =;
 if (sr.status.isSuccess)
  Console.Write("Search Successful");

No comments:

Post a Comment