I have a triggered send set up and it works perfectly. Then in the triggered email there is a cloudpagesurl link with all of the data from triggered send DE. Cloud page redirects to a new page called "subscriptions" where a person can edit it's preferences. After a user edits preferences save button should save data but I have an empty DE. It worked fine until I linked Triggered Send DE through cloudpagesurl. Now I'm drawing blanks.
I tried to do and insertdata in the ampscript but page publish with no error but when I try to post data error 500 comes up.
So here is my question. When a user signs up for a newsletter can a trigger send data be posted to two data extensions (1. trigger send DE, 2. preferences DE)?
current code on signup cloud page
%%[ VAR @ts_email, @FirstName, @LastName, @OptIn, @Date, @IPNaslov, @MC_Unit, @ts_subkey, @ts, @ts_def, @ts_extkey, @ts_bunit, @ts_fname, @ts_lname, @ts_opin, @ts_date, @ts_ip, @ts_statusCode, @ts_statusMsg, @errorCode, @createDuplicate
IF RequestParameter("submitted") == "submitted" THEN
SET @ts_email = RequestParameter("EmailAddress")
SET @FirstName = RequestParameter("FirstName")
SET @LastName = RequestParameter("LastName")
SET @OptIn = RequestParameter("OptIn")
SET @Date = SystemDateToLocalDate(Now(1))
SET @IPNaslov = RequestParameter("IPNaslov")
SET @MC_Unit = "Business unit mid"
SET @ts_extkey = "Triggered send ext key"
InsertData(
"Newsletter_Subscribers",
"SubscriberKey", RequestParameter("SubscriberKey"),
"EmailAddress", RequestParameter("EmailAddress"),
"FirstName", RequestParameter("FirstName"),
"LastName", RequestParameter("LastName"),
"OptIn", RequestParameter("OptIn"),
"IPNaslov", RequestParameter("IPNaslov")
"Date", @Date
)
/* Trigger Send Object Creation */
SET @ts = CreateObject("TriggeredSend")
SET @ts_def = CreateObject("TriggeredSendDefinition")
SET @ts_subkey = @ts_email
/* Specify the external key of the TriggerSend */
SetObjectProperty(@ts_def, "CustomerKey", @ts_extkey)
SetObjectProperty(@ts, "TriggeredSendDefinition", @ts_def)
/* Create the Subscriber Object */
SET @ts_sub = CreateObject("Subscriber")
SetObjectProperty(@ts_sub, "EmailAddress", @ts_email)
/* Set SubscriberKey to EmailAddress */
IF NOT EMPTY(@ts_subkey) THEN
SetObjectProperty(@ts_sub, "SubscriberKey", @ts_subkey)
ELSE
SetObjectProperty(@ts_sub, "SubscriberKey", @ts_email)
ENDIF
/* Fills out the Business unit involved in TriggerSend data extension */
SET @ts_bunit = CreateObject("Attribute")
SetObjectProperty(@ts_bunit, "Name", "ChannelMemberID")
SetObjectProperty(@ts_bunit, "Value", @MC_Unit)
AddObjectArrayItem(@ts_sub, "Attributes", @ts_bunit)
/* Fill out the FirstName field in the TriggerSend data extension */
SET @ts_fname = CreateObject("Attribute")
SetObjectProperty(@ts_fname, "Name", "FirstName")
SetObjectProperty(@ts_fname,"Value", @FirstName)
AddObjectArrayItem(@ts, "Attributes", @ts_fname)
/* Fill out the LastName field in the TriggerSend data extension */
SET @ts_lname = CreateObject("Attribute")
SetObjectProperty(@ts_lname, "Name", "LastName")
SetObjectProperty(@ts_lname,"Value", @LastName)
AddObjectArrayItem(@ts, "Attributes", @ts_lname)
/* Fill out the OptIn field in the TriggerSend data extension */
SET @ts_optin = CreateObject("Attribute")
SetObjectProperty(@ts_optin, "Name", "OptIn")
SetObjectProperty(@ts_optin,"Value", @OptIn)
AddObjectArrayItem(@ts, "Attributes", @ts_optin)
/* Fill out the Date field in the TriggerSend data extension */
SET @ts_date = CreateObject("Attribute")
SetObjectProperty(@ts_date, "Name", "Date")
SetObjectProperty(@ts_date,"Value", @Date)
AddObjectArrayItem(@ts, "Attributes", @ts_date)
/* Fill out the Date field in the TriggerSend data extension */
SET @ts_ip = CreateObject("Attribute")
SetObjectProperty(@ts_ip, "Name", "IPNaslov")
SetObjectProperty(@ts_ip,"Value", @IPNaslov)
AddObjectArrayItem(@ts, "Attributes", @ts_ip)
AddObjectArrayItem(@ts, "Subscribers", @ts_sub)
SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)
IF @ts_statusCode != "OK" THEN
OUTPUTLINE(CONCAT("Status: ",@TriggerSend_statusMsg," / Code: ",@errorCode))
ENDIF
ENDIF
]%%
Tnx in advance