Restrict the Use of Standard External Profiles for Self-Registration, Login, and Assignment to Users (Critical Update)

We have test classes that are failing when we try to insert a portal user.
Error: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, To create or update users for this profile, go to Setup > Communities Settings and select Allow using standard external profiles for self-registration and user creation.: [ProfileId]

Is there a way to create a portal user in the test class without enabling this feature. As a best practice Salesforce recommends not to turn on this feature. (“allow using standard external profiles for self registration and user creation”) we dont want to either just for fixing test classes.


So I’ve found a tentative solution; the error seems to go away when you create a user with a custom profile. If you can, try updating your test class with a non-standard profile.

Source : Link , Question Author : venky , Answer Author : NickNickelodeon

Leave a Comment