RE: Course: SuiteScript 2.0: Extend Netsuite with JavaScript Beginner Help
I’m on the SuiteScript Modules lesson of this course and following along. I thought I’d copied the instructor’s code exactly, but it’s not creating a new phone call when a new employee is created, even though the script is saved in Netsuite. Does anyone see any problems with this script?
/** * @NApiVersion 2.0 * @NScriptType UserEventScript */ define(['N/record'], /** * * @param record */ function(record){ return { afterSubmit: function (context) { log.debug('Hello World'); // var employee = context.newRecord; var empCode = employee.getValue('custentity_sdr_employee_code'); var supervisorId = employee.getValue('supervisor'); log.debug('Employee Code', empCode); log.debug('Supervisor ID', supervisorId); if (context.type == context.UserEventType.CREATE){ var phoneCall = record.create({ type: record.Type.PHONE_CALL }); phoneCall.setValue('title', 'Call HR for benefits'); phoneCall.setValue('assigned', employee.id); phoneCall.save(); } } }; });
phoneCall.save log the return value from this, are you at least seeing the hello world?