You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that even if only one contact is identified in the custom SOQL on the component using some other identifier, it is still possible for the wrong contact to be associated with the created Site User if that contact shares a matching Email Address.
This may be an issue with the Site.CreateExternalUser method: createExternalUser(user, accountId, password)
According to the documentation, it seems to look for any contact under the Account with a matching email.
Thought I would raise this issue for awareness, maybe there is a workaround.
The text was updated successfully, but these errors were encountered:
Interesting find in the documentation. It would seem to defeat the point of going to the trouble of identifying and setting the ContactId on the user object that is passed in as the first parameter. The only workaround I can think of would be to manually craft and inserting the user, setting a ContactId at the point of creation (i.e the one found from the query) and password by using the System.SetPassword() method. However, reading on Stackoverflow I think these methods come with their own issues so will need to explore further...
I suspect Network.createExternalUserAsync(User,Contact,Account) could be the answer here. I may try to see if it'll work if I have time, but thought I'd share here in case you've already tried that or if someone else wants to give it a shot. One substantive difference is that it seems to be very opinionated about the user journey (it sends an email to the user with login information for them to set the password- I don't see an option to supply a password initially nor suppress that email)
I've noticed that even if only one contact is identified in the custom SOQL on the component using some other identifier, it is still possible for the wrong contact to be associated with the created Site User if that contact shares a matching Email Address.
This may be an issue with the Site.CreateExternalUser method: createExternalUser(user, accountId, password)
According to the documentation, it seems to look for any contact under the Account with a matching email.
Thought I would raise this issue for awareness, maybe there is a workaround.
The text was updated successfully, but these errors were encountered: