Hi i am unable to create a dynamic data extension from the existing data extension fields. I am using the following code to get that

<script runat="server">
var dummyDE = DataExtension.Init("80c489be-20f3-448b-b683-2b098cae20dc");
var fields = dummyDE.Fields.Retrieve();
var DE = "MyDataExtension1", FolderName = "Amit";
var FolderAttributes = Folder.Retrieve({
  Property: "Name",
  SimpleOperator: "equals",
  Value: FolderName
var FolderID = FolderAttributes[0].ID;  
var obj = {
  "CustomerKey" :"XYZ",
  "Name": DE,
  "CategoryID": FolderID,
  "Fields": fields
var Status = DataExtension.Add(obj);

The only issue with your code is that you are not referencing a valid Core Library version. Try:


The only other thing to be aware of is, if you have multiple folders named "Amit", then the retrieve function will return multiple objects in the array. Not specifying the exact folder you need may result in the DE being created in a different folder to the one you were expecting.

  • thanks for the help but the issue i found out is with fields. Fields are not getting assigned to DE fields thats why the de is not getting formed . Can u please help on that point , If i pass the regular fields to obj DE is getting formed – user69816 Jun 17 at 5:33
  • Use Write(Stringify(fields)) to see the structure of the fields object, and ensure it's matching with the required structure in the Add DE documentation – Josh de Blank Jun 17 at 23:20

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.