Reputation: 782
I am using SuiteTalk to perform a basic search for Sales Orders
I can get orders just fine, each order comes with an itemList
However, all items in itemList
are missing RecordRef type
. It's not even null. Just. Missing.
(Here's NetSuite documentation showing that it should be part of the object)
I expect some items should be type = RecordRef.kitItem
. And others should be type = RecordRef.inventoryItem
How do I ensure that all items have a RecordRef type? Is there some permission I need to enable on my token?
Upvotes: 0
Views: 268
Reputation: 101
The items in your itemList
are objects of type SalesOrderItem
, and do not have a Type
property. In order to get the Type
of a SalesOrderItem
, you will have to perform an additional search. Below is an advanced search that I wrote to retrieve the Type
of an item, given its internal id.
ItemSearchAdvanced customSearch = new ItemSearchAdvanced()
{
columns = new ItemSearchRow()
{
basic = new ItemSearchRowBasic()
{
type = new SearchColumnEnumSelectField[] { new SearchColumnEnumSelectField() },
}
},
criteria = new ItemSearch()
{
basic = new ItemSearchBasic()
{
internalId = new SearchMultiSelectField
{
@operator = SearchMultiSelectFieldOperator.anyOf,
operatorSpecified = true,
searchValue = new RecordRef[] { new RecordRef { internalId = itemInternalId } };
}
}
}
};
Client.Service.searchPreferences.returnSearchColumns = true;
SearchResult res = Client.Service.search(customSearch);
ItemSearchRow row = (ItemSearchRow)res?.searchRowList?[0];
return row?.basic?.type?[0].searchValue;
Upvotes: 1