1

Am Trying to retrieve Subscribers attribute for my landing page form from the LIST (there is no DE) with the following code but can't

%%[ 

/* i get email address from html email to this landing page */

IF NOT EMPTY(RequestParameter('emailaddr')) THEN 

SET @varemail = RequestParameter('emailaddr') 

ENDIF 

SET @rr_1=CreateObject("RetrieveRequest")

SetObjectProperty(@rr_1,"ObjectType","Subscriber")

AddObjectArrayItem(@rr_1,"Properties","EmailAddress")

    AddObjectArrayItem(@rr_1,"Properties","FirstName")
    AddObjectArrayItem(@rr_1,"Properties","LastName")


SET @sfp=CreateObject("SimpleFilterPart")

SetObjectProperty(@sfp,"Property","EmailAddress")

SetObjectProperty(@sfp,"SimpleOperator","equals")

AddObjectArrayItem(@sfp,"Value",@varemail)

SetObjectProperty(@rr_1,"Filter",@sfp)

SET @sub=InvokeRetrieve(@rr_1)

 IF ROWCOUNT(@sub) == 1 THEN

SET @EArow = Row(@sub,1)

SET @FName = Field(@EArow, "FirstName")

SET @LName = Field(@EArow, "LastName")

 ENDIF

 ]%%

Name: %%=v(@Fname)=%%,  count : %%=v(ROWCOUNT(@sub))=%%

I get count : 0

Any pointers?

1 Answer 1

1

Try this:

%%[

IF NOT EMPTY(RequestParameter([emailaddr])) THEN
    SET @varemail = RequestParameter('emailaddr')
ELSE
    RaiseError('emailaddr parameter not passed.',true)
ENDIF


SET @rr1 = CreateObject("RetrieveRequest")
    SetObjectProperty(@rr1,"ObjectType","Subscriber")
    AddObjectArrayItem(@rr1,"Properties","EmailAddress")

SET @sfp = CreateObject("SimpleFilterPart")
    SetObjectProperty(@sfp,"Property","EmailAddress")
    SetObjectProperty(@sfp,"SimpleOperator","equals")
    AddObjectArrayItem(@sfp,"Value",@varemail)

SetObjectProperty(@rr1,"Filter",@sfp)

SET @atts = InvokeRetrieve(@rr1,@status)

IF RowCount(@atts) > 0 THEN
    SET @subAtts = Field(Row(@atts,1),"Attributes")

    FOR @i = RowCount(@subAtts) TO 1 DO 
        Set @att = Row(@subAtts,@i)
        Set @att_name = Field(@att,"Name")
        Set @att_value = Field(@att,"Value")

        IF @att_name ==  "FirstName" THEN
            Set @fname = @att_value
        ELSEIF @att_name ==  "LastName" THEN
            Set @lname = @att_value
        ELSE ENDIF
    NEXT @i
ENDIF

]%%

Name: %%=v(@fname)=%%, count : %%=v(ROWCOUNT(@atts))=%%

4
  • I get this Error : Invalid row (parameter 1) passed to Field function. Row is null or empty. Function: Field(@att,"Name") ...And i try to debug and see that emailaddr is passed, '@atts' count is 1 but '@att' count is 0
    – Jack85
    Oct 23, 2014 at 8:59
  • FYI, We use the core edition for the account.
    – Jack85
    Oct 23, 2014 at 9:20
  • 1
    Mistake in my code, make this change: Set '@att' = Row('@sub_attributes','@i') to Set @att = Row('@subAtts','@i'). Sorry about that. Oct 23, 2014 at 17:20
  • dont be ...glad you help ...but same error ... i comment-out For-loop and tried to check how far code works... i gets count of atts but still count of subAtts is zero...
    – Jack85
    Oct 23, 2014 at 17:54

You must log in to answer this question.

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