Adding fields to an AddressType in code

Hi!

I’m looking to add a new field, in code, to an AddressType of an organisation. I’ve checked where the Address types are defined in the accelerator in CustomersAddressTypeSetup.cs. But It seems that Litium.Customer.AddressType does not have a property for Fields as FieldTemplateFieldGroup has ? Is it possible to do this in code?

I was hoping i could do something like this:

        new AddressType()
        {
            Id = AddressTypeNameConstants.Address,
            Localizations =
            {
                ["sv-SE"] = { Name = AddressTypeNameConstants.Address },
                ["en-US"] = { Name = AddressTypeNameConstants.Address },
            },
            Fields =
            {
                "New field",
                "And another new field"
            }
        },

Litium version: 7.2

If you need to save custom data there’s a field on the Address object called CustomData that you can use to store it. It’s not visible in the back office though.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.