0

I have made a Retrieve call using the below code, but am struggling to print the Email field values into a clean list.

I can get this output and can see the email addresses are pulling through:

{"Name":null,"Keys":null,"Type":"DataExtensionObject","Properties":[{"Name":"Email","Value":"1449domain@yahoo.com"}],"Client":null,"PartnerKey":null,"PartnerProperties":null,"CreatedDate":"0001-01-01T00:00:00.000","CreatedDateSpecified":false,"ModifiedDate":null,"ModifiedDateSpecified":false,"ID":0,"IDSpecified":false,"ObjectID":null,"CustomerKey":null,"Owner":null,"CorrelationID":null,"ObjectState":null,"IsPlatformObject":false,"IsPlatformObjectSpecified":false}1: {"Name":null,"Keys":null,"Type":"DataExtensionObject","Properties":

The code I'm using is:

<script runat="server">
Platform.Load("Core","1.1.1");
<br><br>
var rr = Platform.Function.CreateObject("RetrieveRequest");<br><br>
Platform.Function.SetObjectProperty(rr, "ObjectType", "DataExtensionObject[1_Master_Data]");<br>
Platform.Function.AddObjectArrayItem(rr, "Properties", "Email");<br>
<br>
do {     var results = [0,0];
    var rows = Platform.Function.InvokeRetrieve(rr, results);  <br>  
    var runstatus = results[0];<br>
    var requestId = results[1];<br>
<br><br>
     if (rows != null) {<br>
        for (var i in rows) {<br>
          var output = rows[i];<br>
          Write(i + ": " + output + " <br/>");<br>
          Write(Stringify(rows[i]));<br>
        } <br>
    } <br>

    rr.ContinueRequest = requestId;<br>
} while (runstatus == "MoreDataAvailable")<br><br>
</script>

thank you

0

try this:

for (var i in rows) {

      var output = rows[i];<br>

      var properties = output["Properties"]

      var email = "";

      for (var j in properties) {
        var name = properties[j]["Name"];
        var value = properties[j]["Value"];

        if(name =="Email") //Find KeyValuePair for email
        {
           email = value;
           break;  // break the properties loop
        }

      }

      if(email!="")
      {
        Write("Email for row " + i + ": " + email + " <br/>");
      }else{
          Write("Can't find email for row " + i + "<br/>");
      }
}

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.