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
Amy HerzAmy Herz 

Can't update ContactId on User record?

I have a use case to create a corresponding Contact every time a User is created. I wanted to use the standard ContactId field on User with a flow so that after the Contact record is created, update ContactId lookup on User, however this does not seem possible?

When I attempt this in execute anonymous, it gives the error "System.DmlException: Update failed. First exception on row 0 with id <id>; first error: UNKNOWN_EXCEPTION, You can't create a contact for this user because the org doesn't have the necessary permissions. Contact Salesforce Customer Support for help.: []"

Does anyone know what the necessary permissions are to write to this field? I can't seem to find any answers yet, probably will contact support after the weekend as well.
Best Answer chosen by Amy Herz
Maharajan CMaharajan C
Hi Amy,

This standard contact field is only applicable for portal users. I think if we populate this contactid for other profiles we will get this error. Better go for custom field in user object.

Thanks,
Maharajan.C

All Answers

ShirishaShirisha (Salesforce Developers) 
Hi Amy,

Greetings!

Seems like this is a limitation from
salesforce.I would suggest you to check the workaround mentioned in the below thread:

https://trailblazers.salesforce.com/answers?id=9063A000000pd6XQAQ

Please mark it as best answer if it helps you to fix the issue.

Regards,
Shirisha Pathuri
Maharajan CMaharajan C
Hi Amy,

This standard contact field is only applicable for portal users. I think if we populate this contactid for other profiles we will get this error. Better go for custom field in user object.

Thanks,
Maharajan.C
This was selected as the best answer