I have the community and logged in as a user with Customer Community user license and Customer Community User profile. There is VF page with the table that shows Contacts related to the logged in User`s Account record.
Logged in user should have the possibility to create new community users that will be assigned to the same Account record.
I am trying to create the new user with
Site.createExternalUser(<user_instance>, <accoundId>) method.
It throws an Exception
Site.ExternalUserCreateException: [You are already logged in.].
Is there any way on how to do that with Site class methods?
I assume, that otherwise I can create Contact and then in
@future method (coz of mixed DML) create the User with ContactId.