Last active
October 17, 2019 13:13
-
-
Save zuzannamj/6d0c9a2122528a31f6ce0e4687922d1e to your computer and use it in GitHub Desktop.
Script for finding a Data Extension and it's folder path using SSJS. Read more here: https://sfmarketing.cloud/2019/10/14/find-a-data-extension-and-its-folder-path-using-ssjs/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script runat="server"> | |
Platform.Load("core","1.1.5"); | |
var DEprop = //use either "Name" or "Customer Key" | |
var DEval = //provide either the Name or External Key | |
var FindDE = DataExtension.Retrieve({Property:DEprop,SimpleOperator:"equals",Value:DEval}); | |
var FolderID = FindDE[0].CategoryID; | |
var DEname = FindDE[0].Name; | |
var list = []; | |
list.push(DEname); | |
var path = function(id) { | |
if (id> 0) { | |
var results = Folder.Retrieve({Property:"ID",SimpleOperator:"equals",Value:id}); | |
list.unshift(results [0].Name); | |
return path(results[0].ParentFolder.ID); | |
} else { | |
return id; | |
} | |
}; | |
path(FolderID); | |
Write(list.join("> ")); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment