You need to sign in to do that
Don't have an account?
Gautam_Kasukhela
Access Community Custom URL in Apex
Hey All,
How can I access a custom URL defined for a community in Apex?
I am getting the base URL in Apex by using
e.g my community base url :
https://abc.force.com/community1
but my Custom URL configured (Setup> Custom URL) for this community is https://www.community1.com
and I want to read the custom URL value in Apex. Any pointers?
Regards,
Gautam.
How can I access a custom URL defined for a community in Apex?
I am getting the base URL in Apex by using
Network.getLoginUrl(communityId)but this does not give me the custom URL, it gives me the base Url.
e.g my community base url :
https://abc.force.com/community1
but my Custom URL configured (Setup> Custom URL) for this community is https://www.community1.com
and I want to read the custom URL value in Apex. Any pointers?
Regards,
Gautam.
All Answers
Greetings!
You can get a Community URL by SOQL Query in Network.
Please replace CommunityName with your community name.
SELECT Name,UrlPathPrefix FROM Network WHERE Name ='CommunityName'
If you find your Solution then mark this as the best answer.
Thank you!
Regards,
Suraj Tripathi
That SOQL does not give me the custom URL, it only gives me 'community1' . I simplified the Custom URL for easy understanding but actually it has no resemblance with the salesforce generated community URL.
In my case , if salesforce generated URL is https://abc.force.com/community1 then custom URL is https://www.goforitadmin.com
and I want the custom URL in apex.