SuiteScript 2.0 - 如何从UserEventType获取字符串

问题描述 投票:0回答:1

以下代码创建一个包含详细信息的日志条目:UserEventType:[object Object],Internal id:11。

define(['N/log'], function (log)
{    
    function afterSubmit(context)
    {
        log.debug({
            title: 'afterSubmit',
            details: 'UserEventType: ' + context.UserEventType + ', Internal id: ' + context.newRecord.id
        });
    }
});

如何从context.UserEventType中获取有意义的字符串?

netsuite suitescript suitescript2.0
1个回答
1
投票

context.UserEventType是一个对象。

因此,要获得完整的日志详细信息,您可以使用

log.debug({
  title: 'afterSubmit',
  details: 'UserEventType: ' + JSON.stringify(context.UserEventType) + ', Internal id: ' + context.newRecord.id
});

要么

log.debug({
  title: 'afterSubmit',
  details: {
    'UserEventType': context.UserEventType,
    'Internal id': context.newRecord.id
  }
});
© www.soinside.com 2019 - 2024. All rights reserved.