List all PublicationLists with 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 type="text/javascript" runat="server"> | |
Platform.Load("core", "1"); | |
var allPublicationLists = getAllPublicationLists(); | |
for (var i in allPublicationLists) { | |
Write("\n" + allPublicationLists[i]["ID"] + "|" +allPublicationLists[i]["Client"]["ID"] + "|" +allPublicationLists[i]["Name"]); | |
} | |
function getAllPublicationLists() { | |
var rr = Platform.Function.CreateObject("RetrieveRequest"); | |
Platform.Function.SetObjectProperty(rr, "ObjectType", "Publication"); | |
Platform.Function.SetObjectProperty(rr, "QueryAllAccounts", "True"); | |
Platform.Function.AddObjectArrayItem(rr, "Properties", "ID"); | |
Platform.Function.AddObjectArrayItem(rr, "Properties", "Name"); | |
Platform.Function.AddObjectArrayItem(rr, "Properties", "Category"); | |
Platform.Function.AddObjectArrayItem(rr, "Properties", "Client.ID"); | |
var reqParams = [0,0]; | |
var publications = Platform.Function.InvokeRetrieve(rr, reqParams); | |
return publications; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I would like to know if can I put the names and Id of the publications lists inside of a table in my web page? if yes, how could I do it? thanks in advance