I'm new to Sitecore
so I could have missed something obvious, but here goes.
We have Commerce engine and API projects. In API, we create a user with CustomerServiceProvider
:
var request = new CreateUserRequest(string.Format("extranet\\{0}", userName), password, email, shopName);
var result = _customerServiceProvider.CreateUser(request);
However, when creating customers this way they can not be found in the Engine project when using the
built-in GetCustomerCommand. When I create a customer using the postman template instead (CustomersAPISamples -> Do Actions -> Add Customer)
,
it's found with no problems with GetCustomerCommand
.
When using the postman template for getting all customers (CustomersAPISamples -> Lists -> Customers)
, it only lists customers created through the add customer postman template.
Regardless of using CustomerServiceProvider or using postman, the entities show up in the database tables sitecore_commerce_storage.CustomersEntity
and CustomerEntities
fine.
They also look identical except IDs, personal details and CreatedBy, UpdatedBy which are missing in the entity created by CustomerServiceProvider (I diffed the entity JSON).
The interesting thing to note is that when creating a user through CustomerServiceProvider, it does return Success: false
, even though it does create the customer entity. There are no system messages.
So how come I can't find some of my customers with the GetCustomerCommand? I thought it would basically just search the entity tables, but apparently it does something more/else. How does it work?