Saturday, December 22, 2018

Web Services: Initialize and Add a Cash Sale from a Sales Order using VB.NET

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

Dim salesOrder As New InitializeRef
salesOrder.internalId = "4119" 'specify internal id

salesOrder.type = InitializeRefType.salesOrder
salesOrder.typeSpecified = True

Dim cashSale As New InitializeRecord
cashSale.type = InitializeType.cashSale
cashSale.reference = salesOrder

Dim cashSaleResponse As ReadResponse = service.initialize(cashSale)

Dim cashSaleRecord As CashSale = DirectCast(cashSaleResponse.record, CashSale)

Dim response As WriteResponse = service.add(cashSaleRecord)

Note: "service" is an instance of NetSuiteService and must be declared and instantiated accordingly.

No comments:

Post a Comment