0

0

I've basically prepared an HTML form on one landing page and On a second landing page I'm getting the data from the first. All of this is working. Now I want to retrieve the record of customer who has recently entered his email in the first landing page HTML Form. Basically to see If the customer record with same email address already exists.

Also, I don't know if this is required or not but the EmailAddress in the DE is the Primary Key which relates to subscribers on sub key.

<script runat="server">
   Platform.Load("Core","1");
    try{
     var DE = DataExtension.Init("SanskarPreferenceDE");
      var FirstName = Request.GetFormField("FirstName");
      var LastName = Request.GetFormField("LastName");
      var EmailAddress = Request.GetFormField("EmailAddress");
      var filter = {Property:"EmailAddress",SimpleOperator:"equals",Value:EmailAddress};
      var data = DE.Rows.Retrieve(filter);
      Write(Stringify(data));
    }
    catch(e){
     Write(Stringify(e));
    }
  </script>

This is the code I'm using. Here, SanskarPreferenceDE is the External Key of the DE. Please let me know what can be done since I'm a complete noob to this technology for now. Also, I've tried to retrieve the fact that Data extension is getting initiated. For this I did

Write(Stringify(DE));

and on the preview page im getting this

{"Rows":{"Lookup":"function","Add":"function","Remove":"function","Update":"function"}}`

Is it correct? Please guide.

3
  • As a note, I ran your code through with Rows.Retrieve (as you showed in your post) and it ran without error. I saw you solved it by going down another route, but wanted to share. – Gortonington Apr 19 at 13:02
  • Oh and the preview page limits the functionality - so do not go by what is displayed there as the final output as for instance, the preview shows that Rows.Retrieve does not exist (the error you are seeing), but once you publish the page, it works. – Gortonington Apr 19 at 13:06
  • 1
    Thanks @Gortonington, I was trying it with the help of retrieve again today and saw your comments, tried to work with it after publishing and ignoring the exception and it worked. Earlier I thought if there was an error on preview page It won't work. Thanks! – Sanskar Vaidya Apr 21 at 7:03
0

I solved this easily by using rows.Lookup instead of rows.retrieve .

0

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.