xxxxxxxxxx
Using the SOQL + Trigger:
SELECT Name, UrlPathPrefix FROM Network WHERE Name = :communityName;
Using the following formula
LEFT(
$Api.Partner_Server_URL_560,
FIND('/services/',$Api.Partner_Server_URL_560)
)
Or this formula:
SUBSTITUTE(
LEFT($Api.Partner_Server_URL_260,FIND("/services", $Api.Partner_Server_URL_530)),
'salesforce.com/',
'site.com/'
)