• Not Answered

Changing User name

Hello everyone,

Is it possible to change the username for commerce user?

4 Replies

  • Yes, is it!

    IVisitorContext service = ServiceLocator.ServiceProvider.GetService<IVisitorContext>();
    ManagerResponse<UpdateUserResult, CommerceUser> managerResponse = AccountManager.UpdateUser(service, profile.FirstName, profile.LastName, profile.PhoneNumber, profile.EmailAddress);
  • In reply to Andrei Paliakou:

    This would update the email address but not the username. OOB username and email are 2 separate fields, but default SXA Registration pushes the email in both fields. The UpdateUser you mentioned here only updates Email. You would need to create an overload for this method to be able to update username.
  • You can also do that in core database, using SQL statements. let me know if you want to go this route. will provide more details
  • In reply to Sachin Magon:

    Thank you Sachin,
    Would you please elaborate a little bit more on this?