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> OperationsupsertList264}"\ncompanyName=" + customer.companyName);} else {_out.error( getStatusDetails( response.status ) );}Javapublic void upsertCustomer() throws RemoteException,ExceededUsageLimitFault,UnexpectedErrorFault, InvalidSessionFault,ExceededRecordCountFault{// This operation requires a valid sessionthis.login(true);Customer customer = new Customer();// Get extenalId for add or update_console.write("\nEnter externalId for customer record to be updated : ");customer.setExternalId(_console.readLn());// Set name and emailcustomer.setEntityId("XYZ 2 Inc");customer.setCompanyName("XYZ 2, Inc.");customer.setEmail("bsanders@xyz.com");// Invoke upsert() operationWriteResponse response = _port.upsert(customer);upsertList}// Process the responseif (response.getStatus().isIsSuccess()){_console.info("\nThe following customer was created/updated successfully:"+ "\nkey=" + ((RecordRef) response.getBaseRef()).getInternalId()+ "\nexternalId=" + ((RecordRef) response.getBaseRef()).getExternalId()+ "\nentityId=" + customer.getEntityId()+ "\ncompanyName=" + customer.getCompanyName()+ "\nemail=" + customer.getEmail());}else{_console.error(getStatusDetails(response.getStatus()));}The upsertList operation is used to add or update one or more instances of a record type in<strong>NetSuite</strong>.If there are multiple records, they can either be of the same record type or different recordtypes. For example, it’s possible to add or update a customer and a contact within a singlerequest using this operation.The upsertList operation is similar to both the addList and updateList operations, but upsertcan be run without first determining whether records exist in <strong>NetSuite</strong>. Records are identified<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!