0

I would like to retrieve the header of a data extension using SSJS within my Landing Page. Below is my code :

<script language="javascript" runat="server">  

     Platform.Load("Core", "1");

     var DE = DataExtension.Init("TEST_1");

     var F = DE.Fields.Retrieve();

     Write(Stringify(F));

  </script>

I tried different scenario but it's like the function :

Fields.Retrieve();

Either don't retrieve the value or the function:

Write(Stringify(F));

Don't display the JSON that the function "Fields.Retrieve()" is getting.

The output I get is :

[]

And I should get something like on the documentation :

https://developer.salesforce.com/docs/atlas.en-us.mc-programmatic-content.meta/mc-programmatic-content/ssjs_dataExtensionFieldsRetrieve.htm

Thanks for your help !

2

To interact with a data extension via server-side JavaScript, you must first initialize the object. It means you need to create it using Email Studio, after creation you need to get the External Key, usually called Customer Key, you can name it with you own pattern. This key is a unique identifier for the Data Extension. This value is used by developers in thei API calls to acess the Data Extension. The DataExtension.Init("Data Extension External Key") is only available on Enterprise and Enterprise 2.0 Account.

This code initializes a data extension with the external key of TEST_1.

var DE = DataExtension.Init("TEST_1");

Thanks

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.