Currently i am stucked in one point that when the customer completes its registration process what i want to do is Create a SeName from customers email address and store it in UrlRecord Table so that i can enable navigation to customers profile page. Below is the code that i had tried till now.
string CustomerSeName = "";
var CustomerModel=_customerService.GetCustomerById(_workContext.CurrentCustomer.Id);
if (CustomerModel != null)
{
CustomerSeName = customer.ValidateSeName(CustomerSeName, CustomerModel.Email, true);
_urlRecordService.SaveSlug(CustomerModel, CustomerSeName, 0);
}
in above code i am getting all the value in CustomerModel and CustomerSeName but when it executes SaveSlug() method it throws an Object reference not set error. I dont know which value it missing.Please help me out if someone knows the solution. Thanks in advance..!
I tried your code and couldn't compile.
After adding ISlugSupported to Customer entity and using this code all worked
The above code also works if there is no email set for current customer.