How to retrieve the Subscriber Id from a landing page given that we know what the Subscriber Key is?

I tried placing the following ampscript and javascript in a landing page and don't see the subscriber id listed.



SET @subkey = requestParameter("Email Address")

SET @rr2 = CreateObject("RetrieveRequest")
AddObjectArrayItem(@rr2, "Properties", "ID")
AddObjectArrayItem(@rr2, "Properties", "EmailTypePreference")
AddObjectArrayItem(@rr2, "Properties", "EmailAddress")
AddObjectArrayItem(@rr2, "Properties", "SubscriberKey")
AddObjectArrayItem(@rr2, "Properties", "Status") 

SET @sfp2 = CreateObject("SimpleFilterPart")


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

IF RowCount(@atts) > 0 THEN

                SET @subAtts = Field(Row(@atts,1),"Attributes")

                FOR @c = RowCount(@subAtts) DOWNTO 1 DO 
                                SET @att = Row(@subAtts,@c)
                                SET @att_name = Field(@att,'Name')
                                SET @att_val = Field(@att,'Value')

Att: %%=v(@att_name )=%%   %%=v(@att_val)=%%<br/>

                NEXT @c


<script  runat="server">


    try {
            var results_DI = Subscriber.Retrieve({Property:"SubscriberKey",SimpleOperator:"equals",Value:"xxx@xxx.com"});
                var resultsLength_DI = results_DI.length;
                Write("<br/>" + resultsLength_DI + "<br/>"); 

var subObj = Subscriber.Init("xxx@xxx.com");
var attributes = subObj.Attributes.Retrieve();
Write("<br/>" + Stringify(attributes) + "<br/>"); 
var listArray = subObj.Lists.Retrieve();
Write("<br/>" + Stringify(listArray)  + "<br/>"); 

    } catch (ex) {
        Write("An error has occurred: " + Stringify(ex));
        Variable.SetValue("@Result", Stringify(ex));  //sets above ampscript variable
  • 1
    Can we see some code to help narrow down the question? – Kelly J Andrews Aug 8 '14 at 9:06

Use the personalization string %%subscriberid%% If the subscriber is coming from an email, and you are using MIRCROSITE BASE URL, it will populate.

|improve this answer|||||
  • The landing page has subscriber key passed to it only. – user10250 Aug 7 '14 at 22:17
  • If the subscribers are arriving from an email, then what @edu8rdo suggested is the way to go. – Adam Spriggs Aug 11 '14 at 17:45
  • The susbscribers are not arriving from an email. – user10250 Aug 11 '14 at 22:50
  • If not from an email, you're going to need to use the microsite's full URL with appended parameters. – Eduardo Arias Oct 27 '14 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.