We are trying to implement Just-in-Time Provisioning for Communities using custom handler class. There are 3 scenarios
- When Contact with the provided email (Federation ID) exist in salesforce and user does not exist:- It creates community user ( links existing contact to user as well, since it is community user which is being inserted ) and login to community successfully.
- When user with the provided email (Federation ID) exist, it simply login to community successfully.
* 3. * When both contact and user do not exist in salesforce, we first inserts a contact and we sets attributes of user like email, last name etc. Insertion of user is automatically taken care by Auth.SamlJitHandler interface's createUser() method, but issue is we are getting MIXED_DML_ERROR due to insertion contact and user in a single transaction.
Ideally Auth.SamlJitHandler interface should have taken of this issue but seems its not working. Did anyone faced similar issue and was able to resolve. It might be possible we are missing some setting or anything in code.
Any help is highly appreciated.Thanks in advance.