Tuesday, April 9, 2019

Get the Internal Dd of the Customer after Performing Customer Search via Java

To get the Internal id of the customer after performing customer search via Java, below is the sample SOAP response which returns a custom field value on the specific entity record :

soapenv:Body
 SearchResponse xmlns="urn:messages_2012_2.platform.webservices.netsuite.com" 
 platformCore:searchResult xmlns:platformCore="urn:core_2012_2.platform.webservices.netsuite.com"
 platformCore:status isSuccess="true"/ platformCore:totalRecords 1 platformCore:totalRecords
 platformCore:pageSize 1000 /platformCore:pageSize 
 platformCore:totalPages 1 /platformCore:totalPages
 platformCore:pageIndex 1 /platformCore:pageIndex 
 platformCore:searchId WEBSERVICES_3470112_052320137878700472056616460_77c83f7f7ef1 platformCore:searchId
 platformCore:searchRowList 
 platformCore:searchRow xmlns:listRel="urn:relationships_2012_2.lists.webservices.netsuite.com" xsi:type="listRel:CustomerSearchRow" 
 -listRel:basic xmlns:platformCommon="urn:common_2012_2.platform.webservices.netsuite.com"
 -platformCommon:entityId platformCore:searchValue xxx platformCore:searchValue  platformCommon:entityId
 -platformCommon:internalId  platformCore:searchValue internalId="xx" platformCommon:internalId 
 /listRel:basic 
 platformCore:searchRow 
 platformCore:searchRowList
 platformCore:searchResult 
 searchResponse

Please try using the sample Java code below :

SearchRow[] searchRows = resp.getSearchRowList().getSearchRow();
for (SearchRow row : searchRows) {
  CustomerSearchRow customerSearchRow = (CustomerSearchRow) row;
  customerSearchRow.getBasic().getInternalId()[0].getSearchValue().getInternalId();
}

No comments:

Post a Comment