AI OnAI Off
You should not have to set the PreferredBillingAddressId and PreferredShippingAddressId to empty before deleting. why do you do that?
I did this because I traced the code in Commerce Manager, and there's a piece of code there:
Of course, I also tried deleting a user without changing the PreferredBillingAddressId and PreferredShippingAddressId, but the result is the same. I still receive a Null Exception.
Hello,
I would like to implement a function for deleting users. For this purpose, I have written the following piece of code:
Apart from the BusinessManager.Delete() method, I also used other methods:
BusinessManager.Delete(entityObject);
or
Each of them was returning a Null Exception. After debugging, I noticed that this is happening because the MapUserKey class has a empty "_converters" list. It's worth adding that when I call the MapUserKey class explicitly in my application, it works correctly, and the "_converters" list has 5 elements.
Stack Trace:
System.NullReferenceException: Object reference not set to an instance of an object.
at Mediachase.Commerce.Customers.MapUserKey.ToUserKey(String typedUserKey)
at Mediachase.Commerce.Customers.CustomerContext.GetUserForContactId(PrimaryKeyId customerContactId)
at Mediachase.Commerce.Customers.Handlers.ContactRequestHandler.PreDelete(BusinessContext context)
at Mediachase.BusinessFoundation.Data.Business.BusinessManager.Execute(Request request)
at Mediachase.BusinessFoundation.Data.Business.BusinessManager.Delete(String metaClassName, PrimaryKeyId primaryKeyId)
Have any of you encountered such an issue? If so, how did you solve it?