My code :

var subscriber = Subscriber.Init("myemail@gmail.com");
var attributes = subscriber.Attributes.Retrieve();

It gives me the output of :

{"Name":"First Name","Value":""},
{"Name":"Last Name","Value":""}, 
{"Name":"Main Interest","Value":""},

As you can see, the function works - it gives me Attributes. Okay, but names of attributes with empty values. Can someone explain why does it happen? Subscriber key is valid :)


Can you confirm you are checking 'myemail@gmail.com' with Subscriber Key and NOT with Email address! enter image description here

Actually I have faced the similar issue, where in the values were there in Tool [which was my assumption!] but was NOT appearing in cloudpage!... and my mistake was I had the 2 records
1) With myemail@gmail.com as my Email Address [I was seeing values of this record in MC Tool]
2) With myemail@gmail.com as my Subscriber Key [But, the cloudpage pulles from this record]

I did a quick check on this as even I received the same out put as you, but as there were NO VALUES!

In MC Tool

enter image description here

So I got the output as below,

Cloud page output

enter image description here

But when I added the values attributes,

In MC tool

enter image description here

Then values were pulled correctly as below,

Cloudpage output

enter image description here

  • Wow you're totally right! But it's weird. Why does my record has empty values?! – Richard98PL Dec 30 '19 at 9:00
  • Hi @Richard98PL thanks for confirming it worked for you. It would be helpful if you up-vote my answer and mark as accepted..... and to answer your above question, there might be many possibilities. But as per my assumption these values are BLANK by default, and this SubscriberKey might be created when you SENT an email by using this record from a Data Extension... Where you have related EMAIL-ADDRESS field to the SUBSCRIBER_KEY!..as below pasteboard.co/INDrmBI.png – Vishal Kumar C V Dec 30 '19 at 11:04
  • Hey I marked your comment but I can't give points yet thanks. :) – Richard98PL Dec 30 '19 at 13:18
  • @Richard98PL welcome.... Hope you are clear, on your above query... when you send a Email from a DE, the attribute values will be BLANK..... they are most likely to be filled, when you import or bring-in LEADS/CONTACTS from other clouds. – Vishal Kumar C V Dec 30 '19 at 14:09
  • 1
    Hi @Gortonington, I completely agree on your point.. I have removed the bold statement, as it might mislead (y) agreed :) – Vishal Kumar C V Dec 31 '19 at 7:51

The following works in my instance:

<script runat="server">
try {
var subscriber = Subscriber.Init("xxxxx");
var attributes = subscriber.Attributes.Retrieve();

  } catch (error) {


Are you using a valid Subscriber Key in var subscriber = Subscriber.Init("myemail@gmail.com")?

One thing you can check, is go to Email Studio > Subscribers > All Subscribers list and find the subscriber with Subscriber Key myemail@gmail.com and check the attributes visible available in there - maybe they're blank or a subscriber with this key doesn't exist. Otherwise the script should work.

  • There is no need to using try/catch since there is no error. I received an output as you can see, but with empty values. I have already checked those fields - they are not empty. Yeah my Subscriber Key is valid since, the method for retrieving subscriber works + if I would input invalid subscriber key I would have an empty array as a result. I have no idea why the script doesn't work. Any other ideas? + btw you should always write error.message, not just error :D that's tip from me – Richard98PL Dec 27 '19 at 15:25
  • I just did some additional testing and run this script from parent and a couple of child BUs, gives correct results each time. And yes, if the subscriber key is invalid, it will return an empty array. – zuzannamj Dec 27 '19 at 15:38

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.