How do I run a saved search for a search type of "saved search" in Netsuite SuiteTalk

3.8k Views Asked by At

I have a saved search in Netsuite UI to search the saved searches. I need to execute this saved search and get the results in suiteTalk.

I have called

GetSavedSearchResult savedSearchResult = service.getSavedSearch(new GetSavedSearchRecord() { searchType = t, searchTypeSpecified = true });

on every searchType and the saved search does not appear in any of the results.

2

There are 2 best solutions below

1
On

You can access the results of an existing saved search using an Advanced Search web service call. You will need to know the type of record for which the saved search was defined. For example, if you want to get the results of an existing saved search that returns customer records, you can do this:

var search = new CustomerSearchAdvanced();
search.savedSearchId = "243";

try
{
    var searchResult = ns.search(search);
    if (searchResult.status.isSuccess)
    {
        foreach(var r in searchResult.searchRowList)
        {
            var row = r as CustomerSearchRow;
            if (row != null)
            {
                Console.WriteLine($"{row.basic.altName[0].searchValue}");
            }
        }
    }
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}

You can see an example of this on page 271 of the 2016.2 SuiteTalk Plaform Guide. The section is called "How do I reference an existing saved search?"

1
On

nlapiLoadSearch("record_Type","Internal_Id_of_saved_search");

Hope this solves your problem