This topic contains 1 reply, has 0 voices, and was last updated by jmitchell 8 years ago.
-
AuthorPosts
-
November 8, 2016 at 6:43 pm #6582
jmitchellI am trying to mark an ItemFulfillment as shipped with a package. The ItemFulfillment record is initially created and picked using WMS Lite RF Mobile Screen.
It is updating the Status field, but it seems to be adding a default package (0.05lb, no description or tracking) instead of the package I specified. What am I doing wrong?
Here is my code (C#):
Code:
//curShipment is an EasyPost shipment after purchasing postage.
//it contains relevant information about the package
ItemFulfillmentPackage package = new ItemFulfillmentPackage();
package.packageWeight = curShipment.parcel.weight;
package.packageWeightSpecified = true;
package.packageTrackingNumber = curShipment.tracking_code;
package.packageDescr = “H2OShip Shipment”;ItemFulfillmentPackageList packages = new ItemFulfillmentPackageList();
packages.package = new ItemFulfillmentPackage[] { package };ItemFulfillment fulfillmentUpdate = new ItemFulfillment();
fulfillmentUpdate.internalId = curFulfillment.internalId;
fulfillmentUpdate.shipStatus = ItemFulfillmentShipStatus._shipped;
fulfillmentUpdate.shipStatusSpecified = true;
fulfillmentUpdate.packageList = packages;SetNetsuitePrefs(); // Sets preferences and authenticates, similar to the ERP example code
WriteResponse response = await System.Threading.Tasks.Task.Run(() => { return nsService.update(fulfillmentUpdate); });
This is a cached copy. Click here to see the original post. -
November 9, 2016 at 4:26 pm #6583
jmitchellAfter more testing, I was able to get the correct package information using ItemFulfillmentPackageUsps, etc that matches the carrier already specified.
However, if I try to choose a different carrier, it gives an error “Switching the shipping method to another carrier is an unsupported operation, because it requires reloading the item fulfillment form for that carrier.”
This is a problem for us because we offer free shipping, which ends up being “choose the cheapest rate for this package from the 3 main carriers”
What do I need to do to correctly set the tracking number and possibly update the shipping method/carrier?
Code:
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
}
SetNetsuitePrefs();
WriteResponse response = await System.Threading.Tasks.Task.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. -
AuthorPosts
You must be logged in to reply to this topic.