Created
May 29, 2020 17:49
-
-
Save jsmithdev/c6ae075f56f5d172486a8d5bad68ff3a to your computer and use it in GitHub Desktop.
find out if lwc etc is running in commmunity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AuraEnabled | |
public static Boolean isCommunity(){ | |
Boolean isCommunity = false; | |
String host = URL.getSalesforceBaseUrl().toExternalForm(); | |
String uri = host.replace('https://', ''); | |
for(Domain d : [SELECT Domain FROM Domain]){ | |
if(d.Domain == uri){ | |
isCommunity = true; | |
} | |
} | |
return isCommunity; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment