Last active
October 6, 2020 23:06
-
-
Save lukethacoder/ad10f417e9e4835405d25ce991d7874c to your computer and use it in GitHub Desktop.
snippet to get a list of Salesforce Communities in APEX
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
List<Network> communities = [ SELECT Id, Name, UrlPathPrefix, Status FROM Network ]; | |
for (Network community : communities) { | |
System.debug(community.Name + ': ' + community); | |
} | |
// or via Connect API | |
List<ConnectApi.Community> communitiesConnect = ConnectApi.Communities.getCommunities().communities; | |
for ( ConnectApi.Community community : communitiesConnect) { | |
System.debug(community.name + ': ' + community); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment