When doing the SuiteScript development, you may encounter this error:
Error Name: INVALID_KEY_OR_REF
Error Statement: Invalid Field reference key Value.
This article would discuss about the possible cause of this issue to help you identify if your error caused by this too, and the way to resolve.
Cause
This exception typically occurs when using SuiteScript to update a field with an invalid value, especially when the field type is list/record. The exception is thrown when the Record.save() method is used instead of the setValue statement.
For example, if a field type is set to “Employee,” it expects to store a valid employee record ID.
If you use SuiteScript to input an invalid ID like -4, which is not a valid employee ID, you may encounter this error when attempting to save the modification.
Troubleshooting Steps
When you encounter this error, you may follow below steps to have more detail about the cause of error.
- Check the Field Type: If it is a custom field, you can identify where to find it by checking the prefix. For example, fields with the prefix custbody can be found under “Transaction Body Fields.”
- Review the Error Message: The error message will indicate the field name and the value used. Determine if the value is as expected. Decide whether the field type or the value should be modified, or if a new record needs to be inserted.
- Use Scripted Records for Further Troubleshooting: Once you know which record type reported the error, check each script to identify which one is setting the value incorrectly.
- Ensure the Field is Updated with a Valid Value: By making sure that the field is only updated with a valid value, you can resolve this error.
About Us
Concentrus is a leading provider of innovative cloud-based enterprise resource planning (ERP) solutions, including NetSuite. Our team of NetSuite experts offers a range of services, including NetSuite price analysis, NetSuite training, and NetSuite integration services.
Our goal is to help businesses of all sizes maximize their investment in NetSuite by providing expert NetSuite cost optimization and implementation strategies. With years of experience as a NetSuite partner, our NetSuite administrators and NetSuite consultants are well equipped to help businesses of all sizes with their NetSuite consulting needs.
Whether you're looking for a NetSuite consultant to help with your NetSuite implementation or you need ongoing NetSuite support, Concentrus is here to help.
Read About Our Implementation Methodology
Want more NetSuite Tips and Tricks? Check out our Short & 'Suite videos