0

I have a simple script to insert SalesOrder objects. Even though the call successfully creates the object in NetSuite, the SOAP response shows an error.

I am unable to determine the missing field based on the response message.

Any ideas?

{"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());

    }
}
Avinash Singh
  • 4,970
  • 8
  • 20
  • 35
Paul N
  • 45
  • 3
  • 6
  • Is "1" an actual customer internal id? – bknights Apr 21 '17 at 23:01
  • Sorry, it should be something else. I removed employer specific code and comments. Also randomized the Ids. – Paul N Apr 21 '17 at 23:57
  • 1
    The code as you've provided works just fine in my test account. The 'SSS_' portion of the error tells me that it's a SuiteScript error. Since the sales order is still being created, I would look for an AfterSubmit User Event script on Sales Orders to see if something there is throwing an exception. – Mike Robbins Apr 24 '17 at 20:42

0 Answers0