SuiteTalk – List Shipping Methods in C#

It was too easy to simply hard code shipping methods until I found the illusive getSelectValue() method.

In the UI: Lists >> Accounting >> Shipping Items

In code:

VS Method

Here is the code if you want to paste it into your project.

Dictionary<string, long> ship_methods;
ship_methods = GetShipMethods(service);

public static Dictionary<string, long> GetShipMethods(NetSuiteService service)
{
Dictionary<string, long> shipMethods = new Dictionary<string, long>();

service.tokenPassport = NSExtensions.TBAtoken.createTokenPassport();
GetSelectValueResult result =
service.getSelectValue(
new GetSelectValueFieldDescription()
{
field = “shipmethod”
,
recordType = RecordType.salesOrder
,
recordTypeSpecified = true
}
, 0
);

if (result.status.isSuccess)
{
foreach (RecordRef record in result.baseRefList)
{
string name = record.name;
string internalId = record.internalId;

shipMethods.Add(name, Convert.ToInt32(internalId));
}
}

return shipMethods;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s