1

On the form submit I want to pass the following values in Triggered Send DE

  1. First Name as @first_name
  2. Last Name as @last_name
  3. Member Number (This will be a unique number and I would like to set it up as subscriber key) as Member_Number
  4. Email Address as @email

  5. URL as @DEColumn2

I tried to excute the following ampscript for the triggered send

%%[
SET @ts = CreateObject("TriggeredSend")
   SET @tsDef = CreateObject("TriggeredSendDefinition")
   SET @ts_subkey = @email  

   SetObjectProperty(@tsDef, "CustomerKey", "External Key of the triggered send")
   SetObjectProperty(@ts, "TriggeredSendDefinition", @tsDef)

   SET @ts_sub = CreateObject("Subscriber")
   SetObjectProperty(@ts_sub, "EmailAddress", @email)  

   IF NOT EMPTY(@ts_subkey) THEN
       SetObjectProperty(@ts_sub, "SubscriberKey", @ts_subkey)
   ELSE
       SetObjectProperty(@ts_sub, "SubscriberKey", @email)
   ENDIF 
   AddObjectArrayItem(@ts, "Subscribers", @ts_sub)
   SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)



   IF @ts_statusCode != "OK" THEN
       RaiseError(@ts_statusMsg, 0, @ts_statusCode, @errorCode)
   ENDIF
 ]%%  

The above code executed successfully and I received the email.

At the moment Email Address is passed as Subscriber Key in the Triggered Send DE.

Is there any documenation to pass these additional fields in the Triggered Send DE.

Also if I make the Member_Number as subscriber key and if a subscriber updates the email address what would be the best way to update the All Subscriber List, as the All Subscriber will still be using the old email address.

0

I was doing some testing and managed to resolve it. PLease find below code

/* Triggered Send */  

   /* Trigger Send Object Creation */
            SET @ts = CreateObject("TriggeredSend")
            SET @tsDef = CreateObject("TriggeredSendDefinition")
            SET @ts_subkey = @email

/* Set the External Key of the Trigger Send Definition */
            SetObjectProperty(@tsDef, "CustomerKey", 'External Key of triggered send')
            SetObjectProperty(@ts, "TriggeredSendDefinition", @tsDef)

/* Create the Subscriber Object */
            SET @ts_sub = CreateObject("Subscriber")
            SetObjectProperty(@ts_sub, "EmailAddress", @email)


/* Set SubscriberKey to EmailAddress */
                SetObjectProperty(@ts_sub, "SubscriberKey", @ts_subkey)


/* Create and Set Attributes */
            SET @attr = CreateObject("Attribute")
            SetObjectProperty(@attr, "Name", "First Name")
            SetObjectProperty(@attr, "Value", @first_name)
            AddObjectArrayItem(@ts_sub, "Attributes", @attr)

            SET @attr = CreateObject("Attribute")
            SetObjectProperty(@attr, "Name", "Last Name")
            SetObjectProperty(@attr, "Value", @last_name)
            AddObjectArrayItem(@ts_sub, "Attributes", @attr)

            SET @attr = CreateObject("Attribute")
            SetObjectProperty(@attr, "Name", "MemberNumber")
            SetObjectProperty(@attr, "Value", @Member_Number)
            AddObjectArrayItem(@ts_sub, "Attributes", @attr)

            SET @attr = CreateObject("Attribute")
            SetObjectProperty(@attr, "Name", "URL")
            SetObjectProperty(@attr, "Value", @DEColumn2)
            AddObjectArrayItem(@ts_sub, "Attributes", @attr)


/* Add all Attributes into Array */
            AddObjectArrayItem(@ts, "Subscribers", @ts_sub)

/*Complete the Web API call to trigger send */
            SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)

/* Raise Error if Trigger fails */
            IF @ts_statusCode != "OK" THEN
               RaiseError(@ts_statusMsg, 0, @ts_statusCode, @errorCode)
            ENDIF 

I took reference from the following post Trigger email from Landing Page via AMPScript

Thanks

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.