5

I am creating a landing page with a form. On submit, the form passes variables to another landing page that will process and perform three different tasks, two of which are performing a TriggeredSend via InvokeCreate().

I am able to generate the TriggeredSend email, however when I attempt to pass through Attributes for the TS, I am met with the error:

Unable to queue Triggered Send request. There are no valid subscribers.

Here is my AMPscript:

%%[

VAR @emailaddr, @MembershipID, @Member_ID, @FirstName, @ts, @ts_def, @ts_externalkey, @ts_sub, @ts_attr, @ts_statusCode, @ts_statusMsg, @errorCode

SET @emailaddr = "[email protected]"

/* Retrieve the POST variables*/

SET @MembershipID = RequestParameter("MembershipID")
SET @Member_ID = RequestParameter("Member_ID")
SET @FirstName = RequestParameter("FirstName")

/* Create the Objects  for the TriggeredSend*/

SET @ts = CreateObject("TriggeredSend")
SET @ts_def = CreateObject("TriggeredSendDefinition")

SetObjectProperty(@ts_def, "CustomerKey", "13323_01137")

SetObjectProperty(@ts, "TriggeredSendDefinition", @ts_def)

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

SET @ts_attr = CreateObject("Attribute")
SetObjectProperty(@ts_attr, "Name", "Member_ID")
SetObjectProperty(@ts_attr, "Value", @Member_ID)
AddObjectArrayItem(@ts_sub, "Attributes", @ts_attr)

SET @ts_attr = CreateObject("Attribute")
SetObjectProperty(@ts_attr, "Name", "MembershipID")
SetObjectProperty(@ts_attr, "Value", @MembershipID)
AddObjectArrayItem(@ts_sub, "Attributes", @ts_attr)

SET @ts_attr = CreateObject("Attribute")
SetObjectProperty(@ts_attr, "Name", "FirstName")
SetObjectProperty(@ts_attr, "Value", @FirstName)
AddObjectArrayItem(@ts_sub, "Attributes", @ts_attr)

AddObjectArrayItem(@ts, "Subscribers", @ts_sub)

/*
SET @ts_statusCode = InvokeCreate(@ts, @ts_statusMsg, @errorCode)

IF @ts_statusCode != "OK" THEN
    VAR @CompleteRows, @RaiseErrorID
    SET @CompleteRows =  LookupRows("RaiseError_Log","StaticField","RaiseError")    
    SET @RaiseErrorID = ADD(RowCount(@CompleteRows),1)
InsertDE("RaiseError_Log","RaiseErrorID",@RaiseErrorID,"ClientID",memberid,"SendID",jobid,"SubscriberKey",_subscriberkey,"EmailAddress",emailaddr,"EmailName",emailname_,"ListID",listid,"ErrorDate",NOW(),"ErrorDescription",@errorCode)       

    RaiseError(@ts_statusMsg, 0, @ts_statusCode, @errorCode)
ELSE ]%%

The email seemed to have sent OK.

%%[ENDIF]%%

The TriggeredSend Interaction is set up using a Data Extension. I pass attributes directly to a TriggeredSend via SOAP - is this not possible with AMPscript?

6
  • Are there any non-nullable values other than the ones you are passing? Commented Nov 19, 2014 at 21:25
  • None. I'm noticing that when the data field "Member_ID" is present in the All Subscribers list under Profile Management - this TriggeredSend does not work. When I remove the "Member_ID" data field from Profile Management, this TriggeredSend does work. However, I have variable Sender Profiles using the Member_ID attribute from Data Extensions which require Member_ID to live in the All Subscribers list.
    – Daniel
    Commented Nov 20, 2014 at 2:41
  • Is it in a 2.0 account? If so, you might need to populate the Client property in TriggeredSend object. Commented Nov 20, 2014 at 14:23
  • What type of field if the member_id profile attribute? Did you know you can also use a Triggered Send Data Extension so you don't need to fill your profile management section with attributes you might not need?
    – patosapir
    Commented Mar 1, 2017 at 22:06
  • @patosapir I don't think that's quite right; depends on whether you've selected to add people to All Subscribers (or any other list) in the Triggered Send Definition. If you have, you need to provide any required attributes. Commented Aug 3, 2017 at 3:49

2 Answers 2

1

First - you are on the right track using the ampscript on the landing page. It's easier that way versus trying to build out a soap call.

Provided that you are not adding to a list with the Triggered Send interaction - your syntax should work.

The error "no valid subscribers" means some data is not matching up in the TriggeredSend Data extension or the List you are adding to (nullable value in a non-nullable field, wrong data type like the DE has a number while the data has an alpha-numeric value - etc). You did a great job, because it seems you have isolated it to the Member_ID value.

I would try to first start by simply try to rename variables the variables you declared in the ampscript.

I've run into a problem where the variables could already been (what seems to be "secretly") declared as pre-defined system variables or already defined as an attribute. So the script could essentially be getting confused between what you are trying to call - the attribute/system variable called "Memeber_ID" or the variable called "Member_ID" in the ampscript which is housing the data you got from the URL.

Try This:

VAR @MemID
SET @MemID = RequestParameter("Member_ID")

Then in your build:

SET @ts_attr = CreateObject("Attribute")
SetObjectProperty(@ts_attr, "Name", "Member_ID")
SetObjectProperty(@ts_attr, "Value", @MemID)
AddObjectArrayItem(@ts_sub, "Attributes", @ts_attr)

You might want to also consider doing the same for @EmailAddr since %%EmailAddr%% is definitely a predefined system attribute.

Not saying it's the answer, but it might be worth a shot before you start dissecting the process.

0

I am aware that this is a really old post, but I recently replaced a code I had built using SSJS with this AMPSCRIPT and it worked perfectly fine. So the reason why this code didn't work to it's owner should probably have to do with not having a DE linked to the triggered send definition or different field names from what the AMPSCRIPT is pointing towards.

1
  • 1
    Welcome to Salesforce Stack Exchange (SFSE)! Please see the note about "commentary on the question or other answers" in Why and how are some answers deleted?, and be aware that your "answer" will most likely be deleted. Please contribute to SFSE in other ways so that you gain reputation - you only need 15 rep to upvote a question and only 50 rep to comment under someone else's question. Or you could possibly ask a new question.
    – Moonpie
    Commented Jan 21, 2022 at 15:21

You must log in to answer this question.

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