Dear Community,
I have one technical question: One of my Marketing cloud client want to dynamically extract DE in a Particular folder to SFTP as a csv or json file. Folder path:
Data Extensions >Interactive Content.
I have tried Pivoting the DE using SQL activity but for Future DEs I need to keep adding the SQl Activity. So client wants to Dynamically extracts DEs from the Folder to SFTP.
Do you have any suggestions to achieve this or any use case from past experience will help me a lot.
Thank you,
Guru
#Trailhead Challenges #Trailhead #SFMC #Marketing Cloud #Marketing Cloud Engagement #AgentforceMarketing
Good question, Guru. The reason columns are missing: your script retrieves the DataExtension object, which only carries Name and CustomerKey. The COLUMNS live on a separate object, DataExtensionField, so you fetch them per DE.
Easiest is SSJS Core (faster than WSProxy). For each customerKey you already have:
var de = DataExtension.Init(customerKey);
var fields = de.Fields.Retrieve();
var columns = [];
for (var i = 0; i < fields.length; i++) {
columns.push(fields[i].Name);
}
Each field also carries FieldType, IsPrimaryKey, MaxLength, Ordinal, DefaultValue and StorageType, so you can capture data types and the primary key too if you want.
So loop your existing DE list, call Fields.Retrieve per customerKey, and add that columns array into your JSON next to the Name and CustomerKey you already have.
if this helps, please mark it as the Best Answer so it helps the next person, thanks 🙂
