Reputation: 781
I need to set the Ship to Country on a Purchase Order from a custom field on the Sales Order. According to NS documentation, (record browser) the field is a text but clearly in the UI it is a drop down. In the Schema browser, it references a Country list where values are _unitedStates (etc).
I have tried to set it with "United States" as well as _unitedStates and neither works. I get an error saying invalid value and then either of the above.
How can this be done?
Upvotes: 2
Views: 2284
Reputation: 350
If anybody else needs NetSuite's country enumeration, here you go:
var countries =
[{text:'Afghanistan',id:'3'},
{text:'Aland Islands',id:'247'},
{text:'Albania',id:'6'},
{text:'Algeria',id:'62'},
{text:'American Samoa',id:'12'},
{text:'Andorra',id:'1'},
{text:'Angola',id:'9'},
{text:'Anguilla',id:'5'},
{text:'Antarctica',id:'10'},
{text:'Antigua and Barbuda',id:'4'},
{text:'Argentina',id:'11'},
{text:'Armenia',id:'7'},
{text:'Aruba',id:'15'},
{text:'Australia',id:'14'},
{text:'Austria',id:'13'},
{text:'Azerbaijan',id:'16'},
{text:'Bahamas',id:'31'},
{text:'Bahrain',id:'23'},
{text:'Bangladesh',id:'19'},
{text:'Barbados',id:'18'},
{text:'Belarus',id:'35'},
{text:'Belgium',id:'20'},
{text:'Belize',id:'36'},
{text:'Benin',id:'25'},
{text:'Bermuda',id:'27'},
{text:'Bhutan',id:'32'},
{text:'Bolivia',id:'29'},
{text:'Bonaire,id: Saint Eustatius and Saba',id:'250'},
{text:'Bosnia and Herzegovina',id:'17'},
{text:'Botswana',id:'34'},
{text:'Bouvet Island',id:'33'},
{text:'Brazil',id:'30'},
{text:'British Indian Ocean Territory',id:'106'},
{text:'Brunei Darussalam',id:'28'},
{text:'Bulgaria',id:'22'},
{text:'Burkina Faso',id:'21'},
{text:'Burundi',id:'24'},
{text:'Cambodia',id:'117'},
{text:'Cameroon',id:'46'},
{text:'Canada',id:'37'},
{text:'Canary Islands',id:'249'},
{text:'Cape Verde',id:'53'},
{text:'Cayman Islands',id:'124'},
{text:'Central African Republic',id:'40'},
{text:'Ceuta and Melilla',id:'248'},
{text:'Chad',id:'212'},
{text:'Chile',id:'45'},
{text:'China',id:'47'},
{text:'Christmas Island',id:'54'},
{text:'Cocos (Keeling}, Islands',id:'38'},
{text:'Colombia',id:'48'},
{text:'Comoros',id:'119'},
{text:'Congo,id: Democratic Republic of',id:'39'},
{text:'Congo,id: Republic of',id:'41'},
{text:'Cook Islands',id:'44'},
{text:'Costa Rica',id:'49'},
{text:"Cote d'Ivoire",id:'43'},
{text:'Croatia/Hrvatska',id:'98'},
{text:'Cuba',id:'52'},
{text:'Curaçao',id:'251'},
{text:'Cyprus',id:'55'},
{text:'Czech Republic',id:'56'},
{text:'Denmark',id:'59'},
{text:'Djibouti',id:'58'},
{text:'Dominica',id:'60'},
{text:'Dominican Republic',id:'61'},
{text:'East Timor',id:'221'},
{text:'Ecuador',id:'63'},
{text:'Egypt',id:'65'},
{text:'El Salvador',id:'208'},
{text:'Equatorial Guinea',id:'88'},
{text:'Eritrea',id:'67'},
{text:'Estonia',id:'64'},
{text:'Ethiopia',id:'69'},
{text:'Falkland Islands',id:'72'},
{text:'Faroe Islands',id:'74'},
{text:'Fiji',id:'71'},
{text:'Finland',id:'70'},
{text:'France',id:'75'},
{text:'French Guiana',id:'80'},
{text:'French Polynesia',id:'175'},
{text:'French Southern Territories',id:'213'},
{text:'Gabon',id:'76'},
{text:'Gambia',id:'85'},
{text:'Georgia',id:'79'},
{text:'Germany',id:'57'},
{text:'Ghana',id:'82'},
{text:'Gibraltar',id:'83'},
{text:'Greece',id:'89'},
{text:'Greenland',id:'84'},
{text:'Grenada',id:'78'},
{text:'Guadeloupe',id:'87'},
{text:'Guam',id:'92'},
{text:'Guatemala',id:'91'},
{text:'Guernsey',id:'81'},
{text:'Guinea',id:'86'},
{text:'Guinea-Bissau',id:'93'},
{text:'Guyana',id:'94'},
{text:'Haiti',id:'99'},
{text:'Heard and McDonald Islands',id:'96'},
{text:'Holy See (City Vatican State},',id:'233'},
{text:'Honduras',id:'97'},
{text:'Hong Kong',id:'95'},
{text:'Hungary',id:'100'},
{text:'Iceland',id:'109'},
{text:'India',id:'105'},
{text:'Indonesia',id:'101'},
{text:'Iran (Islamic Republic of},',id:'108'},
{text:'Iraq',id:'107'},
{text:'Ireland',id:'102'},
{text:'Isle of Man',id:'104'},
{text:'Israel',id:'103'},
{text:'Italy',id:'110'},
{text:'Jamaica',id:'112'},
{text:'Japan',id:'114'},
{text:'Jersey',id:'111'},
{text:'Jordan',id:'113'},
{text:'Kazakhstan',id:'125'},
{text:'Kenya',id:'115'},
{text:'Kiribati',id:'118'},
{text:"Korea,id: Democratic People's Republic",id:'121'},
{text:'Korea,id: Republic of',id:'122'},
{text:'Kosovo',id:'254'},
{text:'Kuwait',id:'123'},
{text:'Kyrgyzstan',id:'116'},
{text:"Lao People's Democratic Republic",id:'126'},
{text:'Latvia',id:'135'},
{text:'Lebanon',id:'127'},
{text:'Lesotho',id:'132'},
{text:'Liberia',id:'131'},
{text:'Libya',id:'136'},
{text:'Liechtenstein',id:'129'},
{text:'Lithuania',id:'133'},
{text:'Luxembourg',id:'134'},
{text:'Macau',id:'148'},
{text:'Macedonia',id:'144'},
{text:'Madagascar',id:'142'},
{text:'Malawi',id:'156'},
{text:'Malaysia',id:'158'},
{text:'Maldives',id:'155'},
{text:'Mali',id:'145'},
{text:'Malta',id:'153'},
{text:'Marshall Islands',id:'143'},
{text:'Martinique',id:'150'},
{text:'Mauritania',id:'151'},
{text:'Mauritius',id:'154'},
{text:'Mayotte',id:'243'},
{text:'Mexico',id:'157'},
{text:'Micronesia,id: Federal State of',id:'73'},
{text:'Moldova,id: Republic of',id:'139'},
{text:'Monaco',id:'138'},
{text:'Mongolia',id:'147'},
{text:'Montenegro',id:'140'},
{text:'Montserrat',id:'152'},
{text:'Morocco',id:'137'},
{text:'Mozambique',id:'159'},
{text:'Myanmar (Burma},',id:'146'},
{text:'Namibia',id:'160'},
{text:'Nauru',id:'169'},
{text:'Nepal',id:'168'},
{text:'Netherlands',id:'166'},
{text:'Netherlands Antilles (Deprecated},',id:'8'},
{text:'New Caledonia',id:'161'},
{text:'New Zealand',id:'171'},
{text:'Nicaragua',id:'165'},
{text:'Niger',id:'162'},
{text:'Nigeria',id:'164'},
{text:'Niue',id:'170'},
{text:'Norfolk Island',id:'163'},
{text:'Northern Mariana Islands',id:'149'},
{text:'Norway',id:'167'},
{text:'Oman',id:'172'},
{text:'Pakistan',id:'178'},
{text:'Palau',id:'185'},
{text:'Panama',id:'173'},
{text:'Papua New Guinea',id:'176'},
{text:'Paraguay',id:'186'},
{text:'Peru',id:'174'},
{text:'Philippines',id:'177'},
{text:'Pitcairn Island',id:'181'},
{text:'Poland',id:'179'},
{text:'Portugal',id:'184'},
{text:'Puerto Rico',id:'182'},
{text:'Qatar',id:'187'},
{text:'Reunion Island',id:'188'},
{text:'Romania',id:'189'},
{text:'Russian Federation',id:'190'},
{text:'Rwanda',id:'191'},
{text:'Saint Barthélemy',id:'26'},
{text:'Saint Helena',id:'198'},
{text:'Saint Kitts and Nevis',id:'120'},
{text:'Saint Lucia',id:'128'},
{text:'Saint Martin',id:'141'},
{text:'Saint Vincent and the Grenadines',id:'234'},
{text:'Samoa',id:'241'},
{text:'San Marino',id:'203'},
{text:'Sao Tome and Principe',id:'207'},
{text:'Saudi Arabia',id:'192'},
{text:'Senegal',id:'204'},
{text:'Serbia',id:'50'},
{text:'Serbia and Montenegro (Deprecated},',id:'51'},
{text:'Seychelles',id:'194'},
{text:'Sierra Leone',id:'202'},
{text:'Singapore',id:'197'},
{text:'Sint Maarten',id:'252'},
{text:'Slovak Republic',id:'201'},
{text:'Slovenia',id:'199'},
{text:'Solomon Islands',id:'193'},
{text:'Somalia',id:'205'},
{text:'South Africa',id:'244'},
{text:'South Georgia',id:'90'},
{text:'South Sudan',id:'253'},
{text:'Spain',id:'68'},
{text:'Sri Lanka',id:'130'},
{text:'St. Pierre and Miquelon',id:'180'},
{text:'State of Palestine',id:'183'},
{text:'Sudan',id:'195'},
{text:'Suriname',id:'206'},
{text:'Svalbard and Jan Mayen Islands',id:'200'},
{text:'Swaziland',id:'210'},
{text:'Sweden',id:'196'},
{text:'Switzerland',id:'42'},
{text:'Syrian Arab Republic',id:'209'},
{text:'Taiwan',id:'225'},
{text:'Tajikistan',id:'216'},
{text:'Tanzania',id:'226'},
{text:'Thailand',id:'215'},
{text:'Togo',id:'214'},
{text:'Tokelau',id:'217'},
{text:'Tonga',id:'220'},
{text:'Trinidad and Tobago',id:'223'},
{text:'Tunisia',id:'219'},
{text:'Turkey',id:'222'},
{text:'Turkmenistan',id:'218'},
{text:'Turks and Caicos Islands',id:'211'},
{text:'Tuvalu',id:'224'},
{text:'Uganda',id:'228'},
{text:'Ukraine',id:'227'},
{text:'United Arab Emirates',id:'2'},
{text:'United Kingdom',id:'77'},
{text:'United States',id:'230'},
{text:'Uruguay',id:'231'},
{text:'US Minor Outlying Islands',id:'229'},
{text:'Uzbekistan',id:'232'},
{text:'Vanuatu',id:'239'},
{text:'Venezuela',id:'235'},
{text:'Vietnam',id:'238'},
{text:'Virgin Islands (British},',id:'236'},
{text:'Virgin Islands (USA},',id:'237'},
{text:'Wallis and Futuna',id:'240'},
{text:'Western Sahara',id:'66'},
{text:'Yemen',id:'242'},
{text:'Zambia',id:'245'},
{text:'Zimbabwe',id:'246'}];
Upvotes: 0
Reputation: 5276
Usually drop-down values need to be set using the internal id. I believe the countries list uses 2 character ids where United States, for example, would be "US". Try using "US" and please let me know if that works. This applies if your custom field references the NetSuite built in list of countries as at Setup > Company > Countries. If the custom field references a custom list for some reason, you would need the internal id for that field value, which would be an integer (you could get this from the list record). Hope it helps.
Upvotes: 5