<@U04D95EGF97> Country IDs are not accesible via a...
# general
a
@Marc Country IDs are not accesible via a regular search and therefore Workflows. You can only get countries abbreviations vs ids via the N/query module(aka SuiteQL), NetSuite country codes(different than IDs) follows the somehow standard list: https://www.nationsonline.org/oneworld/country_code_list.htm
m
But I have a custom field using country list When I configure the condition in my workflow I can see in custom formula : country.id = 3 For example
I Use SuiteScript to Generate a List/File of All Country and State Names/Abbreviations but the id is not the same that I have in my workflow
a
Perfect 👍 , and? How do you translate that 3 to the actual country? There is simply no way without N/query the countries internal IDs are nor available…
m
I understand what you are explaining but what do the country IDs that I see in the workflow custom formula correspond to?
a
That id comes from a table(in the database) that is not exposed to regular saved searches, as simple as that. If I remember correctly you can search for States with a regular saved search but, you can’t search for countries, it not even an option with a regular search.
If you want to look at it in a different way in order to understand, saved searches are a pre-defined and somehow locked way to access database data/tables with some extra flexibility using formulas(but still limited), Queries (N/query), Workbooks(what not) are a new way to access more data allowing multiple levels joins etc…
m
So with n/query i can access to this Table?
e
How about this?
Copy code
function getCountries() {
        var suiteQL = "SELECT Country.ID,Country.Name FROM Country ORDER BY Country.Name";
        var resultSet = query.runSuiteQL(suiteQL);
        var results = resultSet.asMappedResults();
        log.debug('SUITEQL','Country records found = ' + results.length);
        return results;
    }