SuiteTalk:查找未知类型的项目的internalId

时间:2018-10-25 14:16:12

标签: netsuite suitetalk

给出在此查询中找到的项目

var items = netSuiteService.search(new ItemSearch()
{
    basic = new ItemSearchBasic()
    {
        feedName = new SearchStringField()
        {
            searchValue = "Item Name",
            @operator = SearchStringFieldOperator.@is,
            operatorSpecified = true
        }
    }
});

如何在不知道每个项目类型的情况下获得每个项目的internalId

当然,有一种变通方法是要么对所有可能的项目类型进行较大的转换,要么使用反射。 寻找更优雅的解决方案。
可能有其他更一般的查询吗?

我打算使用这些internalIds来创建这样的发票:

var invoice = new Invoice()
{
    entity = new RecordRef()
    {
        type = RecordType.customer,
        internalId = customerInternalId
    },
    account = new RecordRef()
    {
        type = RecordType.account,
        internalId = "1100"
    },
    amountRemaining = 123.5,

    tranDate = DateTime.Parse("2002-10-01"),
    tranDateSpecified = true,

    itemList = new InvoiceItemList
    {
        item = new[]
        {
            new InvoiceItem()
            {
                rate = "123.3",
                description = "First invoice item",
                quantity = 5,
                quantitySpecified = true,
                @class = new RecordRef()
                {
                    name = "Building"
                },
                item = new RecordRef()
                {                                
                    internalId = "298",                               
                    typeSpecified = false
                }
            }
        }
    },

    externalId = "45678",
    tranId = "45678"
};

var result = netSuiteService.add(invoice);

0 个答案:

没有答案