Please help:
I'm developping an interface to download Transaction->Estimate/Quote records from NetSuite to a thrid party processing system. However, I can get all data but the item list, the item list is empty but I know there are item data in actual.
My .Net code is as below:
private void SearchBaseIO()
{
this.Login(true);
TransactionSearch transactionSearch = new TransactionSearch();
TransactionSearchBasic transactionSearchBase = new TransactionSearchBasic();
SearchDateField lastModifyDate = null;
SearchStringField tranId = new SearchStringField();
tranId.@operator = SearchStringFieldOperator.contains;
tranId.operatorSpecified = true;
tranId.searchValue = "51589";
transactionSearchBase.tranId = tranId;
string transType = InitializeRefType.estimate.ToString();
SearchEnumMultiSelectField type = new SearchEnumMultiSelectField();
type.@operator = SearchEnumMultiSelectFieldOperator.anyOf;
type.operatorSpecified = true;
type.searchValue = transType.Split(',');
transactionSearchBase.type = type; ;
transactionSearch.basic = transactionSearchBase;
try
{
SearchResult response = _service.search(transactionSearch);
if (response.status.isSuccess)
{
ProcessBaseIOResponse(response);
SearchMoreBaseIO(response);
}
else
{
Logger.Info(GetStatusDetails(response.status));
}
}
catch (Exception err)
{
throw err;
}
}
private void SearchMoreBaseIO(SearchResult response)
{
while (response.totalRecords > (response.pageSize * response.pageIndex))
{
response = _service.searchMore(response.pageIndex + 1);
// Process response
if (response.status.isSuccess)
{
ProcessBaseIOResponse(response);
}
else
{
Logger.Info(GetStatusDetails(response.status));
}
}
}
private void ProcessBaseIOResponse(SearchResult response)
{
Logger.Info("\nThe search() operation for baseIO was run successfully.");
Logger.Info("\n Total Records = " + response.totalRecords);
Logger.Info(" Total Pages = " + response.totalPages);
Logger.Info(" Page Size = " + response.pageSize);
Logger.Info(" Current Page Index = " + response.pageIndex);
Record[] records = response.recordList;
try
{
for (int i = 0, j = (response.pageIndex - 1) * _pageSize; i < records.Length; i++, j++)
{
Estimate estimate = (Estimate)records[i];
Logger.Info("\n Base_IO IO#:" + estimate.tranId);
if (estimate.itemList != null)
{
for (int k = 0; k < estimate.itemList.item.Length; i++)
{
EstimateItem item = estimate.itemList.item[k];
if (item.item != null)
Logger.Info("\n Base_IO itemID:" + item.item.internalId);
Logger.Info("\n Base_IO NSID:" + item.line);
Logger.Info("\n Base_IO Weight:" + item.quantity);
Logger.Info("\n Base_IO Price:" + item.price);
Logger.Info("\n Base_IO Amount:" + item.amount);
}
}
else
{
Logger.Info("\n no items");
}
Logger.Info("\n Base_IO ShipDate:" + estimate.shipDate);
if (estimate.shipMethod != null)
Logger.Info("\n Base_IO Shipper:" + estimate.shipMethod.name);
Logger.Info("\n Base_IO TrackingNumber:" + estimate.trackingNumbers);
}
catch (Exception err)
{
throw err;
}
}
Do you what's worng in my operation?
Thanks and best regards!Please help:
I'm developping an interface to download Transaction->Estimate/Quote records from NetSuite to a thrid party processing system. However, I can get all data but the item list, the item list is empty but I know there are item data in actual.
My operation is as below:
private void SearchBaseIO()
{
this.Login(true);
TransactionSearch transactionSearch = new TransactionSearch();
TransactionSearchBasic transactionSearchBase = new TransactionSearchBasic();
SearchDateField lastModifyDate = null;
SearchStringField tranId = new SearchStringField();
tranId.@operator = SearchStringFieldOperator.contains;
tranId.operatorSpecified = true;
tranId.searchValue = "51589";
transactionSearchBase.tranId = tranId;
string transType = InitializeRefType.estimate.ToString();
SearchEnumMultiSelectField type = new SearchEnumMultiSelectField();
type.@operator = SearchEnumMultiSelectFieldOperator.anyOf;
type.operatorSpecified = true;
type.searchValue = transType.Split(',');
transactionSearchBase.type = type; ;
transactionSearch.basic = transactionSearchBase;
try
{
SearchResult response = _service.search(transactionSearch);
if (response.status.isSuccess)
{
ProcessBaseIOResponse(response);
SearchMoreBaseIO(response);
}
else
{
Logger.Info(GetStatusDetails(response.status));
}
}
catch (Exception err)
{
throw err;
}
}
private void SearchMoreBaseIO(SearchResult response)
{
while (response.totalRecords > (response.pageSize * response.pageIndex))
{
response = _service.searchMore(response.pageIndex + 1);
// Process response
if (response.status.isSuccess)
{
ProcessBaseIOResponse(response);
}
else
{
Logger.Info(GetStatusDetails(response.status));
}
}
}
private void ProcessBaseIOResponse(SearchResult response)
{
Logger.Info("\nThe search() operation for baseIO was run successfully.");
Logger.Info("\n Total Records = " + response.totalRecords);
Logger.Info(" Total Pages = " + response.totalPages);
Logger.Info(" Page Size = " + response.pageSize);
Logger.Info(" Current Page Index = " + response.pageIndex);
Record[] records = response.recordList;
try
{
for (int i = 0, j = (response.pageIndex - 1) * _pageSize; i < records.Length; i++, j++)
{
Estimate estimate = (Estimate)records[i];
Logger.Info("\n Base_IO IO#:" + estimate.tranId);
if (estimate.itemList != null)
{
for (int k = 0; k < estimate.itemList.item.Length; i++)
{
EstimateItem item = estimate.itemList.item[k];
if (item.item != null)
Logger.Info("\n Base_IO itemID:" + item.item.internalId);
Logger.Info("\n Base_IO NSID:" + item.line);
Logger.Info("\n Base_IO Weight:" + item.quantity);
Logger.Info("\n Base_IO Price:" + item.price);
Logger.Info("\n Base_IO Amount:" + item.amount);
}
}
else
{
Logger.Info("\n no items");
}
Logger.Info("\n Base_IO ShipDate:" + estimate.shipDate);
if (estimate.shipMethod != null)
Logger.Info("\n Base_IO Shipper:" + estimate.shipMethod.name);
Logger.Info("\n Base_IO TrackingNumber:" + estimate.trackingNumbers);
}
catch (Exception err)
{
throw err;
}
}
Do you what's worng in my operation?
Thanks and best regards!