Thursday, October 11, 2018

Web Services: Initialize and Add a Cash Sale from a Sales Order using JAVA

The code snippet below shows how to initialize and add a Cash Sale from a Sales Order using JAVA.

InitializeRef salesOrder = new InitializeRef();
salesOrder.setInternalId("123"); //specify internal id

salesOrder.setType(InitializeRefType.salesOrder);

InitializeRecord cashSale = new InitializeRecord();
cashSale.setType(InitializeType.cashSale);
cashSale.setReference(salesOrder);

ReadResponse cashSaleResponse = _port.initialize(cashSale);

CashSale cashSaleRecord = (CashSale) cashSaleResponse.getRecord();

WriteResponse response = _port.add(cashSaleRecord);



Note: "_port" is an instance of NetSuitePortType and must be declared and instantiated accordingly.

No comments:

Post a Comment