Try our conversational search powered by Generative AI!

Adding addresses to Organization through code

Vote:
 

Hi There,

I am working on integration webservice that will allow user to upload addresses for organisations.

I can't see or find any method or functionality to add address to an organisation.

The only way I found is creating a dummy Contact with out organisation and add address to it with organisation id.

Can any one help me with this please??

Regards

Pradeep

#142133
Dec 01, 2015 17:12
Vote:
 

FYI: I am working on EpiServer Commerce v8.8

#142134
Dec 01, 2015 17:18
Vote:
 

Contacts and organizations are part of Business Foundation in Commerce. Specifically, you should use the BusinessManager API. The trick is to associate the address with the organization key. See the following example:

var billingAddress = CustomerAddress.CreateInstance(); 
billingAddress.AddressType = CustomerAddressTypeEnum.Billing;
billingAddress.Line1 = "Some street";
billingAddress.City = "Some city";
billingAddress.OrganizationId = organization.PrimaryKeyId; 
BusinessManager.Create(billingAddress);
#142136
Dec 01, 2015 23:33
Vote:
 

Thanks Johan. That works.

#142141
Dec 02, 2015 10:15
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.