Modules

filter

 

Objects/Functions

module (N/email)

SuiteScript 2.0

email.sendCampaignEvent(options)

{email}.sendCampaignEvent({campaignEventId: {number*},recipientId: {number*}})

N/email Module
email.sendCampaignEvent()
Method Description: Sends a single “on-demand” campaign email to a specified recipient and return a campaign response ID to track the email. This is used for lead nurturing campaigns (drip marketing email). Email (campaignemail) sublists are not supported. The campaign must use a Lead Nurturing (campaigndrip) sublist. This API normally uses a bulk email server to send messages. If you need to increase the successful delivery rate of an email, use email.send(options) so that a transactional email server is used.
Returns: A campaign response ID (tracking code) as number If the email fails to send, the value returned is –1.
Supported Script Types: Client and server scripts For additional information, see SuiteScript 2.0 Script Types.
Governance: 10 units
Module: N/email Module
Since: 2015.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=email.sendCampaignEvent(options)

Example:

// Code Example 1
// Add additional code
//...
// Create a campaign record in dynamic mode so all field values can be dynamically sourced.
var campaign1 = record.create({
type: record.Type.CAMPAIGN,
isDynamic: true
});
campaign1.setValue({
fieldId: 'title',
value: 'Sample Lead Nurturing Campaign'
});
// set values on the Lead Nurturing (campaigndrip) sublist
campaign1.selectNewLine({
sublistId: 'campaigndrip'
});
// 4 is a sample ID representing an existing marketing campaign
campaign1.setCurrentSublistValue({
sublistId: 'campaigndrip',
fieldId: 'template',
value: 4
});
campaign1.setCurrentSublistValue({
sublistId: 'campaigndrip',
fieldId: 'title',
value: 'Sample Lead Nurturing Event'
});
// 1 is a sample ID representing an existing subscription
campaign1.setCurrentSublistValue({
sublistId: 'campaigndrip',
fieldId: 'subscription',
value: 1
});

// 2 is a sample ID representing an existing channel
campaign1.setCurrentSublistValue({
sublistId: 'campaigndrip',
fieldId: 'channel',
value: 2
});

// 1 is a sample ID representing an existing promocode
campaign1.setCurrentSublistValue({
sublistId: 'campaigndrip',
fieldId: 'promocode',
value: 1
});
campaign1.commitLine({
sublistId: 'campaigndrip'
});

// Submit the record var
campaign1Key = campaign1.save();

// Load the campaign record you just created. Determine the internal ID of the campaign event to the variable campaign2_campaigndrip_internalid_1.
var campaign2 = record.load({
type: record.Type.CAMPAIGN,
id : campaign1Key,
isDynamic: true
});
var campaign2_campaigndrip_internalid_1 = campaign2.getSublistValue({
sublistId: 'campaigndrip',
fieldId: 'internalid',
line: 1
});
// 142 is a sample ID representing the ID of a recipient with a valid email address
var campaignResponseId = email.sendCampaignEvent({
campaignEventId: campaign2_campaigndrip_internalid_1,
recipientId: 142
});
//...
//Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4431144897.html