SuiteTalk – Accounting Lists (Terms, etc.)

I needed to get a list of Terms in SuiteTalk, but was starting to believe this was an impossible task. So I called NetSuite support. From this call, I learned several secret handshakes that made the impossible possible.

This is what I needed, a list of terms that included both internal ID and name:

Setup >> Accounting >> Accounting Lists (Filter on Terms)

Terms

If you search SuiteAnswers, you may bump into this article:

Term 11005

After my call to NetSuite, James found this article. I really don’t like reading SOAP XML, but it provided enough of a hint to solve this problem. Here’s the hint:

TermSearchAdvanced >> TermSearchRowBasic >> internalid & name

SOAP Envenlope

I’m about to show you how this translates into C# code, but first, there is one more gotcha that I need to point out. In order to read Terms, you need the following privilege:

Setup >> Accounting Lists

And now the solution:

Code Example

Here is the code in a form you can cut and paste into your application. You’ll need to create your own token passport or use session based authentication in its place.

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

service.tokenPassport = // You’ll need to create your own passport here
TermSearchAdvanced termSearch = new TermSearchAdvanced()
{
columns = new TermSearchRow()
{
basic = new TermSearchRowBasic()
{
internalId = new SearchColumnSelectField[] { new SearchColumnSelectField() }
,
name = new SearchColumnStringField[] { new SearchColumnStringField() }
}
}
};

SearchResult result = service.search(termSearch);

if (result.status.isSuccess)
{
Console.WriteLine(“Success!”);
foreach (TermSearchRow searchRow in result.searchRowList)
{
TermSearchRowBasic basic = searchRow.basic;
string name = basic.name[0].searchValue;
string internalid = basic.internalId[0].searchValue.internalId;
Console.WriteLine($” {name} – {internalid}”);
}
}
else
{
Console.WriteLine(“Failed!”);
foreach (var statusDetail in result.status.statusDetail)
{
Console.WriteLine($” {statusDetail.message}”);
}
}

return NSTerms;
}

One thought on “SuiteTalk – Accounting Lists (Terms, etc.)

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 )

Google photo

You are commenting using your Google 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