NetSuite SuiteTalk - Retrieve Value String From “SearchColumnSelectCustomField”

后端 未结 2 2015
我在风中等你
我在风中等你 2021-01-07 10:15

I have a small application that iterates over the results of a \"Saved Search\" retrieving the values from several Custom Columns(simplified example):

var re         


        
相关标签:
2条回答
  • 2021-01-07 10:53

    As far as I know, the web service response will only contain the internalId and typeId for a SearchColumnSelectCustomField. In order to get the name, you'll have to first query NetSuite to find all custom lists and their values.

    You can do this using a CustomListSearch and set the bodyFieldsOnly search preference to false. Pass in no criteria to the CustomListSearch and you'll be returned every custom list and their values. Just store there results in memory and reference it when reading the column values from your saved search.

    0 讨论(0)
  • 2021-01-07 11:00

    I tried the answer posted by @Adud123 and it works great, Here's what the code looks like:

    public Dictionary<string, Dictionary<long, string>> getCustomFieldLists()
    {
        return
            nsService.search(new CustomListSearch())
                .recordList.Select(a => (CustomList) a)
                .ToDictionary(a => a.internalId,
                    a => a.customValueList.customValue
                         .ToDictionary(b => b.valueId, c => c.value));
    }
    
    var valueLookup = getCustomFieldLists();
    
    var results = searchResults.Select(a => new
    {
        Z = (a.basic.customFieldList.Where(b => b.scriptId == "custentityZ")
            .Select(a => (SearchColumnSelectCustomField)a)
            .Select(a => valueLookup[a.searchValue.typeId][a.searchValue.internalId])
            .First()
    }
    
    0 讨论(0)
提交回复
热议问题