0

I want to display the names of all the trigger send emails present in the account on landing page. A user should be able to select the one name from this list (Like dropdown list). I have tried for below which I am getting only one result but I need for all trigger sends email names present in an account. I am very thankful for solutions

    %%[

var @ret, @filter, @status, @rr

Set @ret = CreateObject("RetrieveRequest")
SetObjectProperty(@ret,"ObjectType","TriggeredSendDefinition")
AddObjectArrayItem(@ret,"Properties","Name")

Set @filter = CreateObject("SimpleFilterPart")
SetObjectProperty(@filter,"Property","CustomerKey")
SetObjectProperty(@filter,"SimpleOperator","equals")
AddObjectArrayItem(@filter,"Value","TSDCUSTOMERKEY")

SetObjectProperty(@ret,"Filter",@filter)

Set @rr = InvokeRetrieve(@ret, @status)

IF rowcount(@rr) > 0 THEN
      Set @row = row(@rr, 1)
      Set @TSDName = field(@row,"Name")
      OutputLine(concat("TSDName: ",@TSDName))
EndIf

]%%

1 Answer 1

1

In your code, you are not looping over the result set return by InvokeRetrieve. Also if you are filtering your result based on the triggered send customer key, it will give you the single triggered send name matching the filter criteria. Below is the code that I modified for you.

%%[var @ret, @filter, @status, @rr

Set @ret = CreateObject("RetrieveRequest") 
SetObjectProperty(@ret,"ObjectType","TriggeredSendDefinition") 
AddObjectArrayItem(@ret,"Properties","Name")
Set @rr = InvokeRetrieve(@ret, @status)
IF rowcount(@rr) > 0 THEN 
for @i = 1 to rowcount(@rr) do
Set @row = row(@rr, @i) 
Set @TSDName = field(@row,"Name") 
OutputLine(concat("TSDName: ",@TSDName))
next @i
EndIf]%%
1

You must log in to answer this question.

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