CommunitiesUtil Class
Namespace
Example
The following example directs a guest (unauthenticated) user to one page, and authenticated
users of the Experience Cloud site’s parent organization to another
page.
if (Auth.CommunitiesUtil.isGuestUser())
// Redirect to the login page if user is an unauthenticated user
return new PageReference(LOGIN_URL);
if (Auth.CommunitiesUtil.isInternalUser())
// Redirect to the home page if user is an internal user
return new PageReference(HOME_URL);
CommunitiesUtil Methods
The following are methods for CommunitiesUtil. All methods are static.
isGuestUser()
Indicates whether the current user isn’t logged in to the
Experience Cloud site. Redirect the user to log in, if necessary.
Signature
public static Boolean isGuestUser()
Return Value
Type: Boolean
isInternalUser()
Indicates whether the current user is logged in as a
member of the parent Salesforce organization, such as an employee.
Signature
public static Boolean isInternalUser()
Return Value
Type: Boolean