0

isn't EmailAddress one of the Subscriber's attributes? How to fetch it from All Subscribers list (or Subscriber Object) using SSJS with SubscriberKey? Could it be blocked on the parent lvl?

Piece of the code:

var subscriber = Subscriber.Init(subscriberKey);
var attributes = subscriber.Attributes.Retrieve();

returns an array: [{"Name":"Salutation","Value":""}, {"Name":"First Name","Value":"Alex"}, {"Name":"Last Name","Value":""}, {"Name":"VWProfileID","Value":""}, {"Name":"Geburtsdatum","Value":""}, {"Name":"id","Value":""}, {"Name":"sfCampaignId","Value":""}, {"Name":"sfCampaignMemberId","Value":""}] with no EmailAddress attribute.

1 Answer 1

1

EmailAddress indeed is not an attribute, it is a property directly on the subscriber object. Makes sense too, Profile Attributes are things that you configure, whereas EmailAddress is on the subscriber object by default, like SubscriberKey itself, or Status.

Please see here:

https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/subscriber.html#properties

Attributes | Attribute[] |Specifies attributes associated with an object.

vs.

EmailAddress | xsd | Contains the email address for a subscriber. Indicates the data extension field contains email address data.

meaning that you get it like so (alongside subscriberkey and status):


<script type="javascript" runat="server"> 
Platform.Load("Core","1");
var subscriberKey = "mySubscriberKey"
var subResult = Subscriber.Retrieve({Property:"SubscriberKey",SimpleOperator:"equals",Value:subscriberKey});
email = subResult[0].EmailAddress
subscriberKeyResult = subResult[0].SubscriberKey
status = subResult[0].Status
Write(email + " /// ");
Write(subscriberKeyResult+ " /// ");
Write(status);
</script>

result:

[email protected] /// mySubscriberKey /// Active
2
  • Thanks a lot! :)
    – Alex
    Aug 31, 2021 at 8:25
  • no worries, please mark the answer as accepted if this solved your problem.cheers Aug 31, 2021 at 8:33

You must log in to answer this question.

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