如何使用Acumatica ReturnBehavior指定详细记录的字段

时间:2017-05-01 16:29:50

标签: acumatica

我正在尝试使用Acumatica API返回销售订单和销售订单明细列表,同时限制返回的字段。

到目前为止,我有:

 SalesOrder filter = new SalesOrder
                    {
                        //Filter the SOs returned
                        OrderType = new AcumaticaOpticsExt.StringValue { Value = salesOrder.Split('/').First() },
                        OrderNbr = new AcumaticaOpticsExt.StringValue { Value = salesOrder.Split('/').Last() },

                        //Specify return behavior
                        ReturnBehavior = ReturnBehavior.OnlySpecified,

                        //Specify the fields to be returned on the SO
                        Hold = new BooleanReturn(),
                        CustomerName = new StringReturn(),
                        SchedShipment = new DateTimeReturn(),
                        QtyAllocatedM = new DecimalReturn(),
                        QtyAllocatedNotCompletedM = new DecimalReturn(),
                        //And from the SO Line Detail                       

                    };

我不清楚如何从详细信息中指定字段,我在文档中没有找到任何多级使用。

有没有人有例子?

1 个答案:

答案 0 :(得分:2)

这是一个适合我的例子:

SalesOrder so = new SalesOrder
{
    ReturnBehavior = ReturnBehavior.OnlySpecified,
    OrderType = new StringSearch { Value = "SO", Condition = StringCondition.Equal },
    OrderNbr = new StringSearch { Value = "001253", Condition = StringCondition.Equal },
    Details = new SalesOrderDetail[]
    {
        new SalesOrderDetail
        {
            ReturnBehavior = ReturnBehavior.OnlySpecified,
            InventoryID = new StringReturn(),
            LineNbr = new IntReturn(),
            UOM = new StringReturn(),
            UnitPrice = new DecimalReturn(),
            Quantity = new DecimalReturn()
        }
    }
};

您只需要定义详细信息项的数组,在第一个中定义您想要的返回行为级别,以及它是否应用您想要返回的字段。