cja
cja

Reputation: 10016

SuiteScript 2.0 - How to get string from UserEventType

The following code creates a log entry with details: 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
        });
    }
});

How can I get a meaningful string from context.UserEventType ?

Upvotes: 0

Views: 861

Answers (1)

Avi
Avi

Reputation: 2069

context.UserEventType is an Object.

So, to get complete log details you can either use

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

or

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

Upvotes: 1

Related Questions