Sunday, May 26, 2019

C# > Updating Kit Item weight unit.

If you have a Kit Item and you would like to update the weight unit you will need to create a record ref object with the following ID's listed below:

- LB - Pounds = Internal ID 1
- OZ - Ounces = Internal ID 2
- KG - Kilograms = Internal ID 3
- G - Grams = Internal ID 4

Below is the sample code for how to update the weight unit using C#

//Creating the RecordRef Object
RecordRef weightUnit = new RecordRef();
weightUnit.internalId = "1"; // Pounds weight unit.

//Creating and assigning the KitItem object.
KitItem pkg = new KitItem();

//Specifying the internal ID of the kitItem
pkg.internalId = "20006";

//Passing the RecordRef object to the weight unit.
pkg.weightUnit = weightUnit;

// Sending in the update request to NetSuite.
WriteResponse updateRes = nss.update(pkg);

//Checking the response of the update operation.
if (updateRes.status.isSuccess == true)
{
Console.WriteLine("Update Kit Item Success");
Console.ReadKey();
}
else
{
Console.WriteLine("Update Kit Item Failed");
Console.ReadKey();
}

No comments:

Post a Comment