NetSuite Web API - 如何从联接搜索返回/填充销售订单的customFieldList数组?

时间:2018-05-03 18:54:58

标签: c# netsuite suitetalk

我目前正在通过连接多个表的C#执行SuiteTalk搜索,其中一个用于销售订单。在SalesOrder记录上执行典型的GET时,属性customFieldList将填充一系列事务自定义字段/ etc。我很好奇如何在进行搜索时获得相同的信息:

SearchResult searchResult = Client.Service.search(new TransactionSearchAdvanced()
{
    criteria = new TransactionSearch()
    {
        basic = new TransactionSearchBasic()
        {
            type = new SearchEnumMultiSelectField()
            {
                @operator = SearchEnumMultiSelectFieldOperator.anyOf,
                operatorSpecified = true,
                searchValue = new String[] { "_salesOrder" },
            },
            lastModifiedDate = new SearchDateField()
            {
                @operator = SearchDateFieldOperator.after,
                operatorSpecified = true,
                searchValue = fromLastModifiedDateTime.ToUniversalTime(),
                searchValueSpecified = true
            }
        },
    },
    columns = new TransactionSearchRow()
    {
        basic = new TransactionSearchRowBasic()
        {
            internalId = new SearchColumnSelectField[] { new SearchColumnSelectField() },
            tranId = new SearchColumnStringField[] { new SearchColumnStringField() },
            tranDate = new SearchColumnDateField[] { new SearchColumnDateField() },
            dateCreated = new SearchColumnDateField[] { new SearchColumnDateField() },
            item = new SearchColumnSelectField[] { new SearchColumnSelectField() },
            quantity = new SearchColumnDoubleField[] { new SearchColumnDoubleField() },
            lastModifiedDate = new SearchColumnDateField[] { new SearchColumnDateField() },
            email = new SearchColumnStringField[] { new SearchColumnStringField() },
            //customFieldList = new SearchColumnCustomField[] { },
        },
        itemJoin = new ItemSearchRowBasic()
        {
            itemId = new SearchColumnStringField[] { new SearchColumnStringField() },
            type = new SearchColumnEnumSelectField[] { new SearchColumnEnumSelectField() },
        },
        customerJoin = new CustomerSearchRowBasic()
        {
            internalId = new SearchColumnSelectField[] { new SearchColumnSelectField() },
            billAddress = new SearchColumnStringField[] { new SearchColumnStringField() },
            companyName = new SearchColumnStringField[] { new SearchColumnStringField() },
            phone = new SearchColumnStringField[] { new SearchColumnStringField() },
            email = new SearchColumnStringField[] { new SearchColumnStringField() },
        },
        customSearchJoin = new CustomSearchRowBasic[] 
        {

        },
    }
});

我想要填充的属性在TransactionSearchRowBasic对象中注释掉: // customFieldList = new SearchColumnCustomField [] {},

有什么想法吗?提前谢谢!

1 个答案:

答案 0 :(得分:0)

搜索操作不会像在SuiteTalk Web服务上那样返回GET操作所需的信息。

对于SearchResult中返回的每条记录,请使用internalId或文档编号来获取该记录。然后,这应该包括您的自定义字段。

NetSuiteService _service = new NetSuiteService();
ReadResponse res = _service.get(new RecordRef { internalId = internalID, type = RecordType.salesOrder, typeSpecified = true });