Try our conversational search powered by Generative AI!

Adding new fields in OrderAddress - Commerce 9

Vote:
 

Hi

I was trying to add 2 new fields in OrderAddress.

First I add the new fields in Business Foundation in Address, lets call it "NewField1" and "NewField2", and in code I do this:

OrderAddress customerOrderAddress = new OrderAddress
            {
                Name = source.Id.ToString(),
                FirstName = address.FirstName,
                LastName = address.LastName,
                RegionName = address.Region,
                DaytimePhoneNumber = address.Phone,
                EveningPhoneNumber = address.MobilePhone,
                Email = address.Email,
                PostalCode = address.ZipCode,
                Line1 = address.Address,
                Line2 = address.CareOf,
                State = address.Region
            };
            customerOrderAddress["NewField1"] = address.NewField1;
            customerOrderAddress["NewField2"] = address.NewField2;
            return customerOrderAddress;



But when I run the code, I get a null exception in the first NewField1.

Did I forgot something?

Thanks

#141856
Nov 23, 2015 10:30
Vote:
 

Hi

I figured out...

Just must also need to Initialise the new field in IInitializableModule.

with MetaClass.Load()

#141893
Nov 24, 2015 10:11
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.