The title is pretty much self explanatory, but I wanted to know if there is a way by which I can access all Community urls provided I have proper permissions set.

I already looked at Network class but it is only for logged in user and one community.

SO suppose if I have 4 communities created -

  1. www.comm1.com/comm1
  2. www.comm2.com/comm2
  3. www.comm3.com/comm3
  4. www.comm4.com/comm4

I want to access all these 4 urls in normal apex.

Let me know for a way for same.



  • What (part) of the URL do you want to get ? Providing an example in your question may help. The UrlPathPrefix field can be queried from the Network sObject for all communities. Aug 17, 2015 at 10:06
  • added oone edit, let me know if it helps
    – SEuser
    Aug 17, 2015 at 10:10
  • 1
    Related link please check. salesforce.stackexchange.com/questions/7639/…
    – MIX DML
    Aug 17, 2015 at 10:34

1 Answer 1


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.

  • Hi Prakash, Can you please provide the link for where can i see the other fields for Network and Domain Objects
    – AjaySFDC
    Sep 19, 2015 at 7:24
  • Hello Ajay, You need to use workbench or eclipse for see all fields of Network and Domain Objects Oct 7, 2015 at 6:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .