Add fields to AddressTemplateLines Fields

I want to be able to select Region while creating an address. I only select city of type City but all other fields are string or integer. I want to make Region and other fields available in creating the address. I can’t seem to figure out how to add the field to fields table ( MetaFields ) in address template lines.

What is the right way to add address fields available to address template lines ?


Fields table


Address template lines

Hi,
It’s hardcoded :

public class AddressMetaServiceImpl implements AddressMetaService {

  @Override
  public List<String> getAddressFormFieldsList() {

    return List.of(
        "department",
        "subDepartment",
        "buildingName",
        "townName",
        "townLocationName",
        "districtName",
        "countrySubDivision",
        "room",
        "floor",
        "buildingNumber",
        "streetName",
        "postBox",
        "city",
        "zip");
  }

So you need to add your « region » and other custom fields in this list and in your
\axelor-open-suite\axelor-base\src\main\resources\domains\Address.xml

and recompile

1 « J'aime »

Thank you. However, I don’t have experience in recompiling Java application. I do suppose gradle would be used.

In any case, I did resolve the issue by using Groovy templating. I was stupid to not understand that city information is more than enough to pull region, department, canton details. I used templating language like :

${(address.city?.canton == null) ? '' : address.city.canton.name}

to get the canton etc. for the specified city. With this I was able to reformat the address the way I want.

Thank you for the response. I am now able to understand that not everything is managed via studio in axelor.