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 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