10.07.2015 Views

SuiteTalk (Web Services) Platform Guide - NetSuite

SuiteTalk (Web Services) Platform Guide - NetSuite

SuiteTalk (Web Services) Platform Guide - NetSuite

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Web</strong> <strong>Services</strong> Operationssearch225Javapublic void searchCustomer() throws RemoteException,ExceededUsageLimitFault, UnexpectedErrorFault, InvalidSessionFault,ExceededRecordCountFault {// This operation requires a valid sessionthis.login(true);_console.writeLn("\nEnter search parameters");// Instantiate a search object for customers. Note that the search// object is different from the regular record used for add and update.CustomerSearch custSearch = new CustomerSearch();// Search the customer entity id which is a string field_console.write("Entity ID (press enter to skip): ");String nameValue = _console.readLn();SearchStringField entityId = null;if (!nameValue.equals("")) {entityId = new SearchStringField();entityId.setOperator(SearchStringFieldOperator.contains);entityId.setSearchValue(nameValue);custSearch.setEntityId(entityId);}// Search the customer stage which is a list field_console.write("Customer Stage (one or more nsKeys separated by commas, press enter to skip): ");String stageKeysValue = _console.readLn();SearchMultiSelectField stage = null;if (!stageKeysValue.equals("")) {stage = new SearchMultiSelectField();stage.setOperator(SearchMultiSelectFieldOperator.anyOf);String[] nskeys = stageKeysValue.split(",");RecordRef[] recordRefs = new RecordRef[stageKeysValue.length()];for (int i = 0; i < nskeys.length; i++) {RecordRef recordRef = new RecordRef();recordRef.setInternalId(nskeys[i]);recordRefs[i] = recordRef;}stage.setSearchValue(recordRefs);custSearch.setStage(stage);}if (custSearch.getEntityId() == null && custSearch.getStage() == null) {_console.info("\nNo search criteria was specified. Searching for all records.");} else {_console.info("\nSearching for customers with the following criteria: "+ (entityId == null ? "": ("\nentityId=" + custSearch.getEntityId().getSearchValue())+ ", Operator="+ entityId.getOperator().toString())<strong>SuiteTalk</strong> <strong>Platform</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!