* @NScriptType UserEventScript
 * @NApiVersion 2.0
define([‘N/record’, ‘N/email’, ‘N/runtime’, ‘N/task’], function(record, email, runtime, task) {
    return {
        afterSubmit: function(Context) {
            //log.debug(“Hello World”);
            var customer = Context.newRecord;
            var customerId = customer.getValue(‘entityid’);
            var customerEmail = customer.getValue(’email’);
            var salesRepName = customer.getValue(‘salesrep’);
            var couponCode = customer.getValue(‘custentity_sdr_coupon_code’);
            log.audit(‘CUSTOMER ID’, customerId);
            log.audit(‘Customer Email’, customerEmail);
            log.audit(‘SALES REP Name’, salesRepName);
            log.audit(‘COUPON CODE’, couponCode);
            if (Context.type === Context.UserEventType.CREATE) {
                var task = record.create({
                    type: record.type.TASK,
                    defaultValues: {
                        customform: -120
                task.setValue(‘title’, ‘New Customer Follow-up’);
                task.setValue(‘message’, ‘Please take care of this customer and follow-up with them soon.’);
                task.setValue(‘priority’, ‘HIGH’);
                task.setValue(‘company’, customer.id);
                var salesrep = customer.getValue(‘salesrep’);
                if (salesrep) {
                    task.setValue(‘salesrep’, salesrep);
            var user = runtime.getCurrentUser();
                author: user.id,
                recipients: customer.id,
                subject: ‘Welocome_tO_SuiteDreams’,
                body: ‘Welcome!We are glad for you to be a customer of SuiteDreams.’
Rookie Asked on June 22, 2022 in SuiteScript.
Add Comment
1 Answer(s)

My guess is that you need to switch how you get the customer id.


recipients: customer.id,


recipients: customer.getValue('internalid'),

Rookie Answered on June 22, 2022.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor