插入销售订单错误:SSS_MISSING_REQD_ARGUMENT

时间:2017-04-21 22:08:01

标签: c# netsuite suitetalk

我有一个简单的脚本来插入SalesOrder个对象。即使调用在NetSuite中成功创建了对象,SOAP响应也会显示错误。

我无法根据回复消息确定缺少的字段。

有什么想法吗?

  

{"type":"error.SuiteScriptError","name":"SSS_MISSING_REQD_ARGUMENT","message":"parse: Missing a required argument: value","stack":["createError(N/error)","<anonymous>(/SuiteBundles/Bundle 112450/src/2.0/common/object/SWV_CR_Obj_Contract.js:122)","<anonymous>(/SuiteBundles/Bundle 112450/src/2.0/common/object/SWV_CR_Obj_Contract.js:72)","<anonymous>(/SuiteBundles/Bundle 112450/src/2.0/main/ue/SWV_CR_UE_TranCreateContract.js:206)","<anonymous> (/SuiteBundles/Bundle 112450/src/2.0/main/ue/SWV_CR_UE_TranCreateContract.js:287)","createError (N/error)"],"cause":{"name":"SSS_MISSING_REQD_ARGUMENT","m ess age":"parse: Missing a required argument: value"},"id":"","notifyOff":false}

public RecordRef createInternalRef(string id)
{
    RecordRef recordRef = new RecordRef();
    recordRef.internalId = id;
    return recordRef;
}

public void createSalesOrder()
{
    // This operation requires a valid session 
    this.login(true);

    //Initialize Sales Order and set required fields
    SalesOrder order = new SalesOrder();
    order.currency = createInternalRef("1"); 
    order.customForm = createInternalRef("12969"); 
    order.tranDate = DateTime.Today;
    order.entity = createInternalRef("1");
    ////order.exchangeRate;
    order.orderStatus = SalesOrderOrderStatus._pendingBilling;

    //Add  Items to Sales Order
    SalesOrderItem[] salesOrderItemArray = new SalesOrderItem[1];
    SalesOrderItem item = new SalesOrderItem();
    item.item = createInternalRef("425"); 
    item.quantity = 1;
    salesOrderItemArray[0] = item;

    SalesOrderItemList orderItemList = new SalesOrderItemList();
    orderItemList.item = salesOrderItemArray;
    order.itemList = orderItemList;

    // Invoke insert() operation
    WriteResponse response = _service.add(order);

    // Process the response
    if (response.status.isSuccess)
    {
        _out.info(
            "\nThe following Sales Order was Added/Updated successfully:" +
            "\n  internalId=" + order.internalId);
    }
    else
    {
        _out.error("The Sales Order was not Added:", true);
        _out.error(getStatusDetails(response.status));
        _out.error(response.ToString());

    }
}

0 个答案:

没有答案