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)
If you search SuiteAnswers, you may bump into this article:
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
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:
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;
}
Nice article
LikeLike