I am using Salesforce Community and I have network Id of the community but I don’t know how can I get Base URL of my community. Any one know how can I get my community base URL using its id in apex as a internal user.
Is there any other way in which salesforce internal user can get the base URL of all his community in the apex also i don’t find any object in which Community Base URL is stored. I checked network sObject but it only store community path prefix not the complete URL so how can i get the base URL for my community?
Answer
finally i found the answer i use
Network.getLoginUrl(‘Pass Community id here’)
in this way i found the login page URL for the community and then break the URL and use as per my Requirement.
Attribution
Source : Link , Question Author : Tushar Sharma , Answer Author : Tushar Sharma