Reputation: 607
What do I need to do to mark an ItemFulfillment
as shipped, including package information and possibly a different shipping method/carrier using SuiteTalk? We use WMS Lite RF Mobile Screen to initially create the ItemFulfillment
, then a custom app to ship it.
I initially tried using an ItemFulfillmentPackageList
to specify the package, but it seemed to ignore what I specified and add a default package (0.05 lb, no description or tracking).
I then tried ItemFulfillmentPackageUspsList
, etc. and correct package information appeared if it matched the carrier previously specified in the order and fulfillment record. If it doesn't match, I get an error "[Code=JS_EXCEPTION] Error: Switching the shipping method to another carrier is an unsupported operation, because it requires reloading the item fulfillment form for that carrier." We need the ability to switch carriers because we offer free shipping for some orders, which ends up being "pick the cheapest rate for the package from the rates offered by the main 3 carriers".
//curShipment is an EasyPost shipment after purchasing postage.
//it contains relevant information about the package
ItemFulfillment fulfillmentUpdate = new ItemFulfillment();
fulfillmentUpdate.internalId = curFulfillment.internalId;
fulfillmentUpdate.shipStatus = ItemFulfillmentShipStatus._shipped;
fulfillmentUpdate.shipStatusSpecified = true;
fulfillmentUpdate.shipMethod = new RecordRef()
{
// Get the internalId from a saved dictionary
internalId = shipMethods.GetNetsuite(curShipment.selected_rate).netsuiteId
};
switch (curShipment.selected_rate.carrier)
{
case "USPS":
ItemFulfillmentPackageUsps pkgUsps = new ItemFulfillmentPackageUsps();
pkgUsps.packageWeightUsps = curShipment.parcel.weight / 16; // Easypost uses Oz, Netsuite uses Lb
pkgUsps.packageWeightUspsSpecified = true;
if (string.IsNullOrWhiteSpace(curShipment.parcel.predefined_package))
{
pkgUsps.packageLengthUsps = (long)curShipment.parcel.length;
pkgUsps.packageLengthUspsSpecified = true;
pkgUsps.packageWidthUsps = (long)curShipment.parcel.width;
pkgUsps.packageWidthUspsSpecified = true;
pkgUsps.packageHeightUsps = (long)curShipment.parcel.height;
}
pkgUsps.packageTrackingNumberUsps = curShipment.tracking_code;
ItemFulfillmentPackageUspsList pkgListUsps = new ItemFulfillmentPackageUspsList();
pkgListUsps.packageUsps = new ItemFulfillmentPackageUsps[] { pkgUsps };
fulfillmentUpdate.packageUspsList = pkgListUsps;
break;
// Cases for the other carriers, almost identical to USPS above
}
SetNetsuitePrefs(); // Sets preferences and authenticates, similar to the ERP example code
WriteResponse response = await System.Threading.Tasks.Task<SearchResult>.Run(() => { return nsService.update(fulfillmentUpdate); });
// Results in error:
// [Code=JS_EXCEPTION] Error: Switching the shipping method to another carrier is an unsupported operation, because it requires reloading the item fulfillment form for that carrier.
Upvotes: 0
Views: 812
Reputation: 2868
Try setting shipMethod
to the RecordRef for the Shipping Item you will be using. If the SO was entered with a FedEx Shipping Item and now you want to use UPS, then set shipMethod
accordingly and use the carrier-specific package list structure.
Upvotes: 0