This topic contains 1 reply, has 0 voices, and was last updated by adamsharpe 8 years, 2 months ago.
-
AuthorPosts
-
April 18, 2016 at 5:07 pm #6720
Mary GeraldHi,
I have a saved search which has some of the standard item details and some of the custom item Fields. I am trying to get the data from the saved search by giving item number as the parameter. Here we have multiple Locations for the item. I am able to get only total pages and total records using Item Search Advanced. But I don’t know how to proceed to get the item details from the saved search. I am new to the NetSuite. Please suggest me / point me the right direction.
Thanks in Advance.
This is a cached copy. Click here to see the original post. -
August 24, 2016 at 9:49 am #6721
adamsharpeUsing this code, I am able to get the following fields from a saved search: InternalID, TransactionDate, SerialNumber
It took me about a week to figure out how to get this far.
var service = Service.Context();
var serialNumbers = “”;
var tsa = new TransactionSearchAdvanced
{
savedSearchScriptId = “customsearchtest_assemblies”
};
service.searchPreferences = new SearchPreferences { bodyFieldsOnly = false };
tsa.criteria = new TransactionSearch()
{
basic = new TransactionSearchBasic()
{
internalId = new SearchMultiSelectField
{
@operator = SearchMultiSelectFieldOperator.anyOf,
operatorSpecified = true,
searchValue = new[] {
new RecordRef() {
type = RecordType.assemblyBuild,
typeSpecified = true,
internalId = assemblyBuildId
}
}
}
}
};
// Construct custom columns to return
var tsr = new TransactionSearchRow();
var tsrb = new TransactionSearchRowBasic();
var orderIdCols = new SearchColumnSelectField[1];
var orderIdCol = new SearchColumnSelectField();
orderIdCols[0] = orderIdCol;
tsrb.internalId = orderIdCols;
var tranDateCols = new SearchColumnDateField[1];
var tranDateCol = new SearchColumnDateField();
tranDateCols[0] = tranDateCol;
tsrb.tranDate = tranDateCols;
var serialNumberCols = new SearchColumnStringField[1];
var serialNumberCol = new SearchColumnStringField();
serialNumberCols[0] = serialNumberCol;
tsrb.serialNumbers = serialNumberCols;
tsr.basic = tsrb;
tsa.columns = tsr;
var response = service.search(tsa);
if (response.status.isSuccess)
{
var searchRows = response.searchRowList;
if (searchRows != null && searchRows.Length >= 1)
{
foreach (SearchRow t in searchRows)
{
var transactionRow = (TransactionSearchRow)t;
if (transactionRow.basic.serialNumbers != null)
{
return transactionRow.basic.serialNumbers[0].searchValue;
}
}
}
}
return serialNumbers;
-
AuthorPosts
You must be logged in to reply to this topic.