簡體   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