0

I'm having an issue where I'm unable to retrieve any rows from a DE that I know is populated inside an automation.

Here is my code:

<script runat="server">
Platform.Load("core","1");

var stagingDE = DataExtension.Init('Third_Party_Email_Acquisition_Stagingv2');
var filter = {Property:"Processed",SimpleOperator:"equals",Value:"FALSE"};
var data = stagingDE.Rows.Retrieve(filter);
var end = data.length;

for (var i = 0; i < end; i++)
{
     var emailAddress = data[i]['Email'];
     var brand = data[i]['Brand']
     var newEmailAddress = emailAddress.replace("+", "%2B");
     var emailAcqStaging = ent.Third_Party_Email_Acquisition_Staging.replace(".", "%2E");
     var executeURL = 'http://pub.s7.exacttarget.com/5z43cwwr0wy?DE=Third_Party_Email_Acquisition_Stagingv2'+ '&E=' + newEmailAddress + '&B=' + brand;
     var response = HTTP.Get(executeURL);
}  
</script>

I've tested running the HTTP.Get seperatly and know it's working just fine when I hardcoded the url in. If I remove the for loop and just try to parse the first variable in the array, data[0] the script throws errors.

I have also tried removing the filter and just calling Rows.Retrieve, same result as before.

If anyone can help with this that would be great.

  • Noticed I had posted the code that had an error in it (no ';' after Brand). Was a mistake in my copy pasting of the code. That mistake was not in the automation I was running. – Justin Nunn Jul 19 '18 at 18:20
  • 1
    Is that the Data Extension Name or the Data Extension External Key being initiated? It needs to be the Data Extension External Key. If you aren't receiving any results in the retrieve, then I would look at resolving that. – Christopher Carswell Jul 20 '18 at 0:22
  • Thank you Carswell, that was it! I was using an example someone else here had done and hadn't noticed they changed the external id on their DE to match it's name. It's not letting me mark this as the answer, is that because it's a comment? If you want to get marked as having answered it go ahead and make an answer and I'll check it. – Justin Nunn Jul 20 '18 at 12:47
2

I believe the issue relates to the "DataExtension.Init" part of your code.

var stagingDE = DataExtension.Init('Third_Party_Email_Acquisition_Stagingv2');

This is because if you aren't retrieving any results from the following, then your Data Extension isn't being initiated correctly.

var data = stagingDE.Rows.Retrieve()

Check to ensure that you're using the external key of your Data Extension, and not the name (I know the documentation doesn't explicitly mention this).

1

Not only do you need to use the Data Extension ExternalID for initializing this data extension to be read from, it must be in the same business unit. IE. You cannot open a shared data extension from another business unit using a name like "ent.DataExtensionName" nor by its external id from the other business unit. Retrieve always seems to return no rows in either case.

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.