Skip to content

Instantly share code, notes, and snippets.

@wvpv
Created March 20, 2019 15:26
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save wvpv/5a21a0c229a37846f88b77fd8e73e3d7 to your computer and use it in GitHub Desktop.
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

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