繁体   English   中英

如何从Netsuite Suitescript 2.0获取错误消息中的字段标签?

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

我收到来自netsuite的错误消息,例如

  • 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.

很难理解哪个字段是错误的,哪个值是错误的。

如何从Suitescript 2.0中获取带有特定字段标签名称的错误消息?

AFAIK,当您尝试保存记录时,NetSuite将返回上述所有错误。 因此覆盖它们并不容易,但是您可以使用以下解决方法。

try-catch块中编写代码,然后验证错误消息以检查某些字段值是否无效。 如果字段值无效,则可以使用nsRecord.getField从记录中获取该字段,然后使用field.label获取其标签,并覆盖错误消息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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