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
Spencer BerkSpencer Berk 

Creating a User record in a flow is not accepting ProfileId?

I am recieving this flow error when trying to create a User record: 
Error Occurred: This error occurred when the flow tried to create records: INVALID_FIELD_FOR_INSERT_UPDATE: User: bad field names on insert/update call: ProfileId

I am pulling the 15 Character Profileid text from the URL while viewing the specific profile in setup.

Any suggestions on what I am doing wrong?
User-added image
User-added image
AnudeepAnudeep (Salesforce Developers) 
You have to verify if the profile has the ability to create a user. Usually happens if there is a guest user and the user does not have access to Profiles etc. Following query should help confirm

SELECT HasReadAccess, recordId FROM UserRecordAccess where UserId='0053B000001t0QOQAY' AND recordId='00e3B000000MJDg'
Spencer BerkSpencer Berk
Thanks Anudeep, that is most likely my problem. I can't seem to find the right setting. What setting would I change to give the Guest User the ability to create users?
AnudeepAnudeep (Salesforce Developers) 
It appears that the user does not have apiAccess on the field ProfileId on User entity. This causes the field to get bad field error which I believe translates to REQUIRED_FIELD_MISSING error 

I can't seem to find a way to give FLS for this field. You can try granting delegated external administration rights to a user

Also, I found a help article that says this is working as designed

Flow throws error: "REQUIRED_FIELD_MISSING: Required fields are missing: [ProfileId]"

https://help.salesforce.com/apex/HTViewSolution?urlname=INTERNAL-Flow-throws-error-REQUIRED-FIELD-MISSINGRequired-fields-are-missing-ProfileId&language=en_US  (Article shows 404 for some reason)

Community partner user unable to create a partner user on the same partner account using flows. Flow fails with below exception though the profileId value been passed.

"REQUIRED_FIELD_MISSING: Required fields are missing: [ProfileId]"

In fact, the partner community user can create the partner user successfully without flows.
 
NOTE: This applies to community customer user as well.

 
Its confirmed that when you go to enable partner/customer user from the UI (i.e. log in as DPUA(Delegated External/Partner User Administrator) and enable from community) it works as expected. As long as you ensure that,
  • There are licenses for the type you want to enable
  • There are profiles associated in the DPUA related list on the profile of the DPUA user
  • Delegated External Admin perm is turned on
You can try engaging support to find out the exact cause of the issue 

So this is neither a regression nor a bug. Simply not supported.

 
PayCaptainPayCaptain
I have this issue too,  Did you ever find a solution?  THANKS!!
Sunayana RajuSunayana Raju
I am facing this issue and trying to solve since 3 days. Has anybody found any solution. I hv tried using olduser's profile I'd while creating new user record , but it's showing.. missing field required i.e profileId
Sikandar PathanSikandar Pathan

Hi,

Found a solution for this, run your flow in system context without sharing - Access All Data.

User-added image