Hi Everyone,
I have an Experience Cloud site where the users are using the Customer Community Plus license.
I have a requirement to create a new Customer Community Plus user from an LWC/Apex component. As part of the user creation process, I need to select the appropriate Customer Community Plus Profile.
To populate the Profile selection, I need to fetch the available Profiles from the org using Apex.
I tried the following SOQL:
List<Profile> profiles = [
SELECT Id, Name
FROM Profile
];
However, when this code executes in the context of a Customer Community Plus user, I receive the following error:
sObject type 'Profile' is not supported
I also understand that Experience Cloud users have restrictions on accessing certain standard objects.
My questions are:
- Is there any way to grant a Customer Community Plus user access to the Profile sObject through a Profile, Permission Set, or any other Salesforce configuration?
- If direct access to the Profile object is not supported for Customer Community Plus users, what is the recommended Salesforce approach for retrieving the appropriate Customer Community Plus Profile when creating another user?
- Is there any supported Apex/API approach to retrieve the available Customer Community Plus Profiles without directly querying the Profile object?
My requirement is specifically:
Existing Customer Community Plus user → LWC/Apex → Create a new Customer Community Plus user → Select the appropriate Customer Community Plus Profile
Any guidance or recommended approach would be greatly appreciated.
Thanks!
Hi Kavya,
Building on the thread — if ProfileId is confirmed non-null right before the call and it's still throwing REQUIRED_FIELD_MISSING: [Profile], the next thing to isolate is execution context:
1. Confirm whether your Apex is running "with sharing" or plain (not "without sharing" explicitly) — Site.createExternalUser() needs to execute with elevated setup-object permissions, so if it's inheriting the Community Plus user's restricted session context instead of running as intended, the Profile assignment can get silently dropped even with a valid Id.
2. Check the executing user (or the context the Apex actually runs under) has Manage External Users, and ideally test with Manage Users temporarily to rule out a permission gap vs. a code issue.
3. Try hardcoding a known-good Profile Id directly in an anonymous Apex test (bypassing your LWC/Custom Metadata layer entirely) and call Site.createExternalUser() with it. If that also fails with the same error, it's confirmed to be a permissions/context issue, not a value-passing issue in your component.
Reference:
https://help.salesforce.com/s/articleView?id=005094369&language=en_US&type=1The anonymous Apex test is the fastest way to isolate whether this is your code or your running user's permissions.