Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
List all PublicationLists with SSJS
<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>
@murilofrederico
Copy link

murilofrederico commented Feb 14, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment