0

My use case is: I have an email, which contains a button. When a customer clicks on a button in the email, an internal user should receive a notification of his data (Name, Email).

I tried it with the Triggered Send, however, when I clicked on the button I'm only receiving the notification. This notification should go to the internal user email.

This should happen in real-time.

%%[

Set @SubscriberKey = RequestParameter("SubscriberKey")
Set @FirstName = RequestParameter("FirstName")
Set @LastName = RequestParameter("LastName")
 SET @EmailAddress = "xxxx@gmail.com"
 SET @TriggerSendExternalKey = "xxx_Notification"

 /* Specify the external key of the TriggerSend */
 SET @TriggerSend = CreateObject("TriggeredSend")
 SET @TriggerSendDefinition = CreateObject("TriggeredSendDefinition")
 SetObjectProperty(@TriggerSendDefinition, "CustomerKey", @TriggerSendExternalKey)
 SetObjectProperty(@TriggerSend, "TriggeredSendDefinition", @TriggerSendDefinition)

 /* Specify the email address and the subscriber key */
 SET @TriggerSendSubscriber = CreateObject("Subscriber")
 SetObjectProperty(@TriggerSendSubscriber, "EmailAddress", @EmailAddress) 
 SetObjectProperty(@TriggerSendSubscriber, "SubscriberKey", @SubscriberKey) 


 /* Fill out the FirstName field in the TriggerSend data extension */
 SET @TriggerSendFirstName = CreateObject("Attribute")
 SetObjectProperty(@TriggerSendFirstName, "Name", "FirstName")
 SetObjectProperty(@TriggerSendFirstName,"Value", @FirstName)
 AddObjectArrayItem(@TriggerSend, "Attributes", @TriggerSendFirstName)

 AddObjectArrayItem(@TriggerSend, "Subscribers", @TriggerSendSubscriber)  

 SET @TriggerSend_statusCode = InvokeCreate(@TriggerSend, @TriggerSend_statusMsg, @errorCode) 

 IF @TriggerSend_statusCode != "OK" THEN
  OUTPUTLINE(CONCAT("Status: ",@TriggerSend_statusMsg," / Code: ",@errorCode))
 ENDIF

]%%

<script>
url = "https://company.xxx.com/contact/";
// Simulate an HTTP redirect:
setTimeout(function() { // timer
window.location.replace(url);
}, 2000); // 2000 ms =  2 seconds
</script>
3

You cannot trigger an email from within another email.

I’d suggest pointing the button to a CloudPage first. On the CloudPage include the script to trigger the notification email and at the end include a Redirect function to take the subscriber to the desired website:

Redirect(“https://company.xxx.com/contact/“)

The whole thing might take a split second longer to load, but the subscriber won’t notice anything.

If you want to pass any data from the email to the CloudPage to include it in the triggered send, make sure to pass it in the CloudPagesURL function when creating the button in the email.

This example includes the string value as part of a name and value pair.

%%=CloudPagesURL(ID, 'CampaignCode', @CampCode)=%%
1
  • @salesforce-user - if this answer helped you, please remember to accept it by clicking the checkmark - thanks!
    – zuzannamj
    Aug 10 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.