Netsuite通过customfield搜索销售订单

时间:2018-01-11 01:03:08

标签: c# netsuite

有一个salesorder opject,我想使用tranid字段进行搜索。 我怎样才能做到这一点? 我知道如何使用internalid或extrenalid进行搜索,但没有关于tranid的线索

1 个答案:

答案 0 :(得分:0)

以下是如何在C#中执行此操作的示例。

SearchResult result = service.search(new TransactionSearch()
    {
        basic = new TransactionSearchBasic()
        {
            type = new SearchEnumMultiSelectField() {
                @operator = SearchEnumMultiSelectFieldOperator.anyOf,
                operatorSpecified = true,
                searchValue = new string[] { "_salesOrder" }
            },
            tranId = new SearchStringField()
            {
                @operator = SearchStringFieldOperator.@is,
                operatorSpecified = true,
                searchValue = "SO364886"
            }
        }
    }
);

if(result.status.isSuccess && result.totalRecords == 1)
{
    SalesOrder salesOrder = (SalesOrder)result.recordList[0];
    System.Console.WriteLine("Internal ID = " + salesOrder.internalId);
} else
{
    System.Console.WriteLine("Couldn't find sales order!");
}