function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kailash chandrakailash chandra 

how to get all community pages by apex

I need to list all community pages in dropdown on lightning pages.
How can I get all community pages using apex ?


User-added image


Regards
------------
Kailash Chandra
 
Deepali KulshresthaDeepali Kulshrestha
Hi Kailash,

You can soql query as:

SELECT Domain, DomainType FROM Domain

SELECT Name, UrlPathPrefix FROM Network
You will get the domain and then all communities and build your logic.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha.