在Netsuite中,我希望美国和加拿大移至国家/地区列表的顶部。有没有办法做到这一点?
答案 0 :(得分:1)
如果您将SuiteScript 2.0 Suitelet与Form一起使用,则可以像下面这样获取国家列表:
var custRec = record.create({ type: record.Type.CUSTOMER, isDynamic: true });
var custSubrec = objRecord.getCurrentSublistSubrecord({ sublistId: 'addressbook', fieldId: 'addressbookaddress' });
var countryFieldObj = objSubrecord.getField({ fieldId: 'country' });
var countryList = countryFieldObj.getSelectOptions();
然后创建字段并插入国家/地区
var countryField = form.addField({ id: 'custpage_country', type: 'select', label: 'Country' });
// Add the US and CA first
for (var i = 0; i < countryOptions.length; i++) {
if (countryOptions[i].value === US || countryOptions[i].value === CA) {
countryField.addSelectOptions({
value : countryOptions[i].value,
text : countryOptions[i].text
});
}
}
// Then add the rest of the countries in after
for (var i = 0; i < countryOptions.length; i++) {
if (countryOptions[i].value !== US || countryOptions[i].value !== CA) {
countryField.addSelectOptions({
value : countryOptions[i].value,
text : countryOptions[i].text
});
}
}
我希望这会有所帮助!