Avatar

Level 1

Hi there,

 

Wondered if you might be able to help? We have the below bit of JS that is supposed to add a record to the Recipient table, save it, extract the id, then in turn add the record to a Subscription list within Adobe Campaign Classic. The code works as expected, however for whatever reason, no Confirmation (Subscribed) email is being triggered and sent out. We have attached a 'Subscribed' email template (with Target Mapping set to nms:subscription ) however no email is still being sent. If however, we manually add an entry into the Subscription list, the email is sent to the recipients email address. Is there possibly some additional value we need to add to confirm that we would like to trigger the Confirmation email message to send?

 

Below is the current code:

 

// create a new recipient with the specified email address
    var newRecipient = nms.recipient.create('<recipient xtkschema="nms:recipient" email="' + email + '" firstName="' + firstName + '" lastName="' + lastName + '" text1="' + text1 + '" text2="' + text2 + '" text3="' + text3 + '" folder-id="' + iRecipientFolderId + '" />');
    newRecipient.save();

    iRecipientId = newRecipient.id;

    //subscribe to service
    var iServiceId = sqlGetInt("SELECT iServiceId From NmsService WHERE sName = 'NameOfService'");
    xtk.session.Write(<subscription _operation="insert" recipient-id={iRecipientId}
      service-id={iServiceId}
      xtkschema="nms:subscription" />);

 

Thanks for any help you can offer.