使用Restlet(SS2)提交NetSuite供应商付款时遇账户字段无效报错
Let's break down why you're hitting this INVALID FIELD VALUE error for the account field in your NetSuite Vendor Payment script, and how to fix it:
Common Causes & Fixes
1. Verify the Account's Internal ID is Correct & Valid
The error message says "Invalid Field Value 129 for account"—first, double-check that 129 is the correct internal ID of a valid payment account (like a bank account, since vendor payments require a spendable account).
- In NetSuite, navigate to the account record and check the URL: the number after
id=is the internal ID (e.g.,https://your-account.netsuite.com/app/accounting/accounts/register.nl?id=129). - Ensure the account is not marked inactive (check the "Is Inactive" checkbox on the account record) and is assigned to your current subsidiary (if using a multi-subsidiary setup).
2. Confirm the Field ID is Correct
You mentioned trying accountid and acctnum—for native NetSuite Vendor Payment records, the correct field ID for the payment account is account in static mode. To be 100% sure:
- Go to
Customization > Lists, Records, & Fields > Record Types > Vendor Payment > Fieldsand look for the "Account" field to confirm its ID (no custom prefix likecustrecord_should be present).
3. Check Static Mode Value Formatting
Since you're using isDynamic: false, the value type must match the field's data type. The account field expects a numeric internal ID, so passing 129 (as a number, not string) is correct. However:
- Avoid passing unnecessary string values (like
"1.00"forexchangerate—use the numeric1.00instead, as it's a currency field).
4. Try Dynamic Mode (Alternative Approach)
Sometimes static mode has edge cases with field dependencies. Switching to dynamic mode can resolve this, as it mimics manual record creation:
function _post(context) { var vendorBillPayment = record.create({ type: record.Type.VENDOR_PAYMENT, isDynamic: true, defaultValues: { entity: 1054 } }); vendorBillPayment.setValue({ fieldId: "entityname", value: "Nikon" }); vendorBillPayment.setValue({ fieldId: "account", value: 129 }); vendorBillPayment.setValue({ fieldId: "currency", value: 1 }); vendorBillPayment.setValue({ fieldId: "customform", value: 45 }); vendorBillPayment.setValue({ fieldId: "exchangerate", value: 1.00 }); var recordId = vendorBillPayment.save(); }
5. Rule Out Permissions
Ensure the role executing the script has full access to the account record. Test running the script with an administrator role to eliminate permission-related issues.
内容的提问来源于stack exchange,提问作者Ash

