3

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?

  • Hi, which version of sitecore commerce you are using? – Vipin Banka Nov 25 '19 at 13:59
  • @VipinBanka Sorry, that should've been in the post. Sitecore 9.2. Sitecore.Commerce.Core 4.0.72. Sitecore.Commerce.Plugin.Customers 4.0.16 (latest). – user3533716 Nov 25 '19 at 14:20
  • please check that you have customer entity id entry in [CustomersLists] table for list name "List-CUSTOMERS-ByDate" – Vipin Banka Nov 25 '19 at 14:37
  • @VipinBanka yes, the entity is in CustomersLists as well. imgur.com/E75kvrH – user3533716 Nov 26 '19 at 7:41
1

The issue is now solved.

It turned out it was a misconfigured environment. Customers created from our API were placed under a blank environment in Sitecore Experience Commerce.

For anyone else with the same problem, make sure to configure your "defaultEnvironment" in wwwroot\sc92.local\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config.

For other similar issues it might also help to clear the caches and clean / re-bootstrap and re-initialize your environments in the SitecoreCommerce_DevOps Postman templates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.