Retrieve Custom URL for the Experience Community in Apex: how can I do that?

For example, I have site X and Domain Y and I need to know what is the Custom URL for the Site X using Domain Y?

1 Answer 1


This is easy, we need to query DomainSite standard object, for example, if Domain Y uses CdnPartner and Site name is X, we may use the following query to get this data

SELECT Id, Domain.Domain, PathPrefix, Site.Name FROM DomainSite WHERE Domain.HttpsOption = 'CdnPartner' AND Site.Name = 'Y'

and then we can just concatenate the Domain.Domain with PathPrefix to get the full link

You must log in to answer this question.

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