November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi,
CustomerContact has a property named ContactOrganization, or you can get the OrgarnizationId by CustomerContact.OwnerId (make sure to check if those are null)
Regards.
/Q
Hello,
Thanks for your reply. I managed to solve this and this is how I did it. I got really surprised that I had to use something awkward like GetContactByUserId("String:" + user.Email) ...
//Get current user as contact and get contacts organisation id
var customerContact = CustomerContext.Current.CurrentContact;
var organizationId = customerContact.ContactOrganization.PrimaryKeyId;
//Get the created user as contact and set the ownerid which is the organisations id the same as the current user
var newCustomerContact = CustomerContext.Current.GetContactByUserId("String:" + user.Email);
if (newCustomerContact != null)
{
newCustomerContact.OwnerId = organizationId;
newCustomerContact.SaveChanges();
}
Hello,
I want to do the following scenario. I am logged in QuickSilver as user with a specific role, let's say "UserAdmin" and I want to create a user myself that will be part of the same organisation as I am, i.e. using the same form as for registering a normal user.
I am not sure how to get the organisation the current user belongs - I think I need to relate user to contacts of organisation. The documentation I have found here http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Commerce/9/Customers/Customers/ I think is outdated as those functions are now obsolete and obviously not covering everything. For instance the right way to get all the organisations now is using
var organizations = CustomerContext.Current.GetOrganizations();
Submit
Any ideas how to do this right?
[Pasting files is not allowed]