function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Aakriti GoyalAakriti Goyal 

SOQL INVALID_FIELD error on User.ProfileId for Salesforce Platform User

Hi,
We have a running application that has a custom lightning component to create partner users. User is successfully created in the context of System Admin. But when trying to create a partner user in the context of a salesforce platform user, we get an INVALID_FIELD error on the ProfileId field of the user.

After looking into existing questions, I found that "View Setup and Configuration" permission is required to access a profile on the user object. Even after enabling the permission on the profile level, the User gets the same INVALID_FIELD error for the profileId field of the user object.

Is there any other permission required to access profileId field of User object?
AnudeepAnudeep (Salesforce Developers) 
Hi Aakriti, 

Can you also provide 'Manage Internal Users' and 'Manage External Users' permission?

Please see this post to learn more

Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Aakriti GoyalAakriti Goyal
Thanks Anudeep, But we are using the Salesforce Platform license & we can not provide 'Manage Internal Users' and 'Manage External Users' permissions to the profiles having Salesforce Platform user license.
AnudeepAnudeep (Salesforce Developers) 
Are you able to access other fields on the user object? In certain cases, access to few objects are restricted for salesforce platform license users for example cases

I suggest raising a support case to confirm this behavior

Also, what do you see when you run the following code as the user?
 
SObjectType accountType = Schema.getGlobalDescribe().get('User');
Map<String,Schema.SObjectField> mfields = accountType.getDescribe().fields.getMap();

For issues like this, I have seen everyone ensure there is field accessibility/field level security in general. However, I don't think we can give access to profileId