简体   繁体   中英

How to get label of field in error message from Netsuite Suitescript 2.0?

I am getting error messages from netsuite like

  • The field custevent97 contained more than the maximum number ( 5 ) of characters allowed
  • You have entered an Invalid Field Value 1511 for the following field: contact
  • Phone number should have seven digits or more.

It is difficult to understand which field is wrong & which value is wrong.

How to get error message with label name of specific field from suitescript 2.0?

AFAIK, all of the above errors will be returned by NetSuite when you try to save a record. So it won't be easy to overwrite them but you can use workaround as below.

Write your code in try-catch block and then validate error message to check if some field value is invalid. If field value is invalid, you can then fetch the said field from record using nsRecord.getField , and then fetch its label using field.label , and overwrite the error messages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM