NetSuite: Get all country list

This is a Java Snippet to get all the countries in NetSuite

public void getCountryList() throws Exception{
    GetSelectValueFieldDescription desc = new GetSelectValueFieldDescription();
        desc.setRecordType(RecordType.customer);
    desc.setSublist("addressbookList");
        desc.setField("country");

        GetSelectValueFilter myfilter = new GetSelectValueFilter();
        myfilter.setOperator(GetSelectValueFilterOperator.contains);
        myfilter.setFilterValue("states");

        GetSelectValueResult result = _port.getSelectValue(desc, 0);
        BaseRefList baseRef = result.getBaseRefList();
        System.out.println("Total countries: " +  result.getTotalRecords());
        //Loop to all the values
        for (int i = 0; i < result.getTotalRecords(); i++)
        {
            System.out.println("Country: " + baseRef.getBaseRef(i).getName() + " " + baseRef.getBaseRef(i));
        }
  }

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>