0

I have a page for subscribers.

The intent is to have new subscribers inserted into a DE and have a triggered send to send a welcome mail. But on the other hand, if someone is already a subscriber we recognize his with lookuprows and send him a "we know you" triggered send email.

I keep getting errors:

  • 18000 - Triggered Send Object not found
  • 18002
    • Triggered Send Definition ID/Customer Key don't match (misspelled in code)
    • Triggered Send must be in an Active or Inactive status
    • No Triggered Send Definition ID or External key supplied
    • Triggered Send Definition ID is invalid
    • The Triggered Send Object must contain the Triggered Send ID or the Customer Key
    • The TriggeredSendDefinitionID provided is not valid for this account
    • Invalid Customer Key
    • The Triggered Send Definition is not completely configured or in a new status) ,
  • 180008 - There are no valid subscribers
%%[

IF @RowCount == 0 THEN

    SET @extkey = "11111"

ELSEIF @rowCount == 1 AND @OptIn == true AND (@Topic1 == true OR @Topic2 == true OR @Topic3 == true OR @Topic4 == true) THEN

    SET @extkey = "11112"

ENDIF

]%%

%%[

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 = "111111111"

/* 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

]%%

Any ideas?

1
  • The details on the error code page should give you some hints. Please update your question to include some details about your Triggered Send Definitions -- name, customer/external keys, target data extension schema, etc. Commented Sep 18, 2020 at 14:11

1 Answer 1

4

This should be relatively straightforward, you probably didnt tell your code which Triggered Send to send.

In this bit:

/* Specify the external key of the TriggerSend */
SetObjectProperty(@ts_def, "CustomerKey", @ts_extkey)

you are referencing the variable @ts_extkey but your subscriber might be in a condition where it's not set.

Why? You have not technically ensured that your IF statement is actually met, it is technically possible that a user is in neither condition, because you just have an IF and an ELSEIF. You did not use a generic ELSE as a fallback. So if a recipients meets neither the IF nor the ELSEIF condition, everything breaks. That is probably the root cause.

In order to code more defensively, add an ELSE condition. In my example I then trigger a fallback Triggered Send, but anything goes here. Do nothing, add the customer to a log data extension, use RaiseError() function. Whatever makes sense in your usecase, as the simple existence of the ELSE condition will stop the error from occuring.

SET @fallbackTS = "xxxxxx"
IF @RowCount == 0 THEN

    SET @extkey = "11111"

ELSEIF @rowCount == 1 AND @OptIn == true AND (@Topic1 == true OR @Topic2 == true OR @Topic3 == true OR @Topic4 == true) THEN

    SET @extkey = "11112"

ELSE 
    SET @extkey = @fallbackTS
ENDIF

Of course then, you should investigate why your subscriber does not fall under the right condition and make sure that only absolute exceptions go into the fallback condition. Hope this helps!

2
  • I won't eve bother to explain how dumb I feel right now. Tnx you all for your help. Error 180008 should have clarified it for me. There was a line hardcoded so it didn't read the input field correctly thus could not find subscriber data.
    – Urke
    Commented Sep 21, 2020 at 7:18
  • no worries, we've all been there :) Commented Sep 21, 2020 at 7:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .