搜索中的NetSuite Web服务自定义字段

时间:2016-07-27 18:27:18

标签: c# web-services netsuite

我似乎无法使用Web服务提取事务搜索的自定义字段值。

        searchTransaction.savedSearchId = "2017";
        SearchResult result = netsuite.search(searchTransaction);

        if(result.status.isSuccess)
        {
            SearchRow[] searchRows = result.searchRowList;
            if(searchRows != null && searchRows.Length >= 1)
            {
                for (int i = 0; i < searchRows.Length; i++)
                {
                    TransactionSearchRow transactionRow = (TransactionSearchRow)searchRows[i];
                    var iid = transactionRow.basic.internalId[0].searchValue;
                    double amount = transactionRow.basic.amount[0].searchValue;
                    string custfild = transactionRow.basic.customFieldList[0].scriptId;

                    Console.WriteLine("\n Transaction ID: " + iid.internalId);
                    Console.WriteLine("\n Amount: " + amount.ToString());
                    Console.WriteLine("\n customfield: " + custfield.ToString());
                }
            }
        }

我知道该字段正在返回,因为我可以在xml响应中看到它。而custfield.ToString()确实返回自定义字段的内部ID。

我似乎无法获得实际价值。

1 个答案:

答案 0 :(得分:0)

想出来,发布以防其他人有同样的问题:

        searchTransaction.savedSearchId = "2017";
        SearchResult result = netsuite.search(searchTransaction);

        if(result.status.isSuccess)
        {
            SearchRow[] searchRows = result.searchRowList;
            if(searchRows != null && searchRows.Length >= 1)
            {
                for (int i = 0; i < searchRows.Length; i++)
                {
                    TransactionSearchRow transactionRow = (TransactionSearchRow)searchRows[i];
                    var iid = transactionRow.basic.internalId[0].searchValue;
                    double amount = transactionRow.basic.amount[0].searchValue;
                    string custfild = transactionRow.basic.customFieldList[0].scriptId;

                    SearchColumnStringCustomField custfild =  (SearchColumnStringCustomField)transactionRow.basic.customFieldList[0];

                    Console.WriteLine("\n Transaction ID: " + iid.internalId);
                    Console.WriteLine("\n Amount: " + amount.ToString());
                    Console.WriteLine("\n custfild: " + custfild.searchValue);

                }
            }
        }