Thursday, February 14, 2019

C# > Web Services > Creating a search in web services to search for support cases with attachments

In order to retrieve support cases that have files attached to the actual case itself you must do a SupportCaseSearchAdvanced with a fileJoin on the columns. You will need to specify a Name for the columns that you wish to return however you don't need to specify any criteria when makes this search.

Below is C# Sample code to be able to run a SupportCaseSearchAdvanced with column names specified. Please note you need a valid Login session to perform any operation in Web Services.

// creating the required objects
SupportCaseSearchAdvanced csca = new SupportCaseSearchAdvanced();
SupportCaseSearch csc = new SupportCaseSearch();
SupportCaseSearchRow scsr = new SupportCaseSearchRow();
FileSearchRowBasic fsrb = new FileSearchRowBasic();

// assigning a label to a column
SearchColumnSelectField[] scsf = new SearchColumnSelectField[1];
SearchColumnSelectField scsf1 = new SearchColumnSelectField();
scsf1.customLabel = "id";
scsf[0] = scsf1;

// assigning a label to a column
SearchColumnStringField[] scf = new SearchColumnStringField[1];
SearchColumnStringField scf1 = new SearchColumnStringField();
scf1.customLabel = "name";
scf[0] = scf1;

// assigning the objects to the necessary NetSuite objects
csca.criteria = csc;
csca.columns = scsr;
scsr.fileJoin = fsrb;
fsrb.internalId = scsf;
fsrb.name = scf;

// Process the search
SearchResult sr = new SearchResult();
sr = nss.search(csca);

No comments:

Post a Comment