NetSuite SuiteTalk - Retrieve Value String From “SearchColumnSelectCustomField”

你说的曾经没有我的故事 提交于 2019-12-01 01:15:20

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.

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()
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!