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
Wei Dong 10Wei Dong 10 

How to dynamic create a User with a Community profile?

As what I asked above, how can I do that in apex code?
Plz tell me step by step in codes.

PS:I didn't find profile about "Custom Community" profile?
Deepali KulshresthaDeepali Kulshrestha
Hi Wei,

There is a one way to Create a Community User via Apex from a Contact.

Please refer link below for more information:
https://salesforce.stackexchange.com/questions/166947/creating-a-community-user-via-apex-from-a-contact
https://developer.salesforce.com/forums/?id=906F0000000AeeuIAC
                                                                        
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks.    
Deepali Kulshrestha