Thursday, February 14, 2019

Web Services > C# > Looking for a specific support case and returning the names of files attached to the case

The following is a sample of a SupportCaseSearchAdvanced. This sample looks for specific case with file attachments. You will need to replace the internal id.


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

// Assigning the column id
SearchColumnSelectField[] scsf = new SearchColumnSelectField[1];
SearchColumnSelectField scsf1 = new SearchColumnSelectField();
scsf1.customLabel = "id";
scsf[0] = scsf1;

//Assigning the column id
SearchColumnStringField[] scf = new SearchColumnStringField[1];
SearchColumnStringField scf1 = new SearchColumnStringField();
scf1.customLabel = "name";
scf[0] = scf1;

//Specifying the internal id of the support case
RecordRef[] crf = new RecordRef[1];
RecordRef crf1 = new RecordRef();
crf1.internalId = "4";
crf1.type = RecordType.supportCase;
crf1.typeSpecified = true;
crf[0] = crf1;

//Specifying the search operators
SearchMultiSelectField smsf = new SearchMultiSelectField();
smsf.@operator = SearchMultiSelectFieldOperator.anyOf;
smsf.operatorSpecified = true;
smsf.searchValue = crf;

// Assigning the objects to the required NetSuite Objects
csca.criteria = csc;
csc.basic = cscb;
cscb.internalId = smsf;
csca.columns = scsr;
scsr.fileJoin = fsrb;
fsrb.internalId = scsf;
fsrb.name = scf;

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

No comments:

Post a Comment