如何判断 Netsuite 是否处于 View/Edit 模式?

How to tell if Netsuite is in View/Edit Mode?

有没有办法判断我们是处于 netsuite 记录的编辑模式还是查看模式?我尝试使用 executionContext,但无论是查看还是编辑都是一样的,所以没有用。如果我处于编辑模式,我只想隐藏一些字段,如果我在视图中则显示它们。我正在使用 suitescript 2.0。

谢谢

模式通过 type 属性 传递给 beforeLoad 事件。该值是 context.UserEventType.

的枚举
function beforeLoad(context) {
  if (context.type === context.UserEventType.EDIT) {
    // ...
  }
}

查看 NS 帮助页面 "beforeLoad(scriptContext)" 和 "context.UserEventType" 了解参考详情。