cancel
Showing results for 
Search instead for 
Did you mean: 

How to set Address Node for Customer

former_member253394
Participant
0 Kudos

Hi All,

I have requirement of setting the Address node(Address.Root) in customer through code for some specific scenario. I am facing the below error while creating address node :

<Note>Node Address.ROOT cannot be created separetely without node ADDRESS_INFORMATION.</Note>

Can you please let me know if i am missing anything.

Thanks,

Malkit Singh

Accepted Solutions (1)

Accepted Solutions (1)

MarkusPenn
Advisor
Advisor
0 Kudos

Hi,

Address.Root is created implicitly if an AddressInformation node is created, there is no way to create an Address.Root node instance directly. See also attached BO model as reference ...

Regards,

Markus

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Malkit,

Through code you can do something like it to create one address:

customer = this;

...

var addressInformation = customer.AddressInformation.Create();

var address = addressInformation.Address;

if (!address.IsSet())

  address = addressInformation.Address.Create();

var addressRepresentation = address.DefaultPostalAddressRepresentation;

if (!addressRepresentation.IsSet())

  addressRepresentation = address.DefaultPostalAddressRepresentation.Create();

addressRepresentation.CityName = "city"

addressRepresentation.CountryCode = "BR";

addressRepresentation.DistrictName = "district";

addressRepresentation.HouseID = "number";

...

A customer can have multiple addresses but just one is the default address, if you need it, you can identify it using the flag:

customer > AddressInformation > AddressCurrentAddressDeterminationProcesses > DefaultAddressDeterminationProcessRelevanceIndicator

Regards,

Alexandre.