Announcement

Collapse
No announcement yet.

Adding new field to addresses

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding new field to addresses

    The single street address field provided by default is not adequate for our addressing needs so I'm looking to add a second street address field.

    It's easy enough to create the text field in Accounts, but what I cannot see is how to associate that with the aggregate fields "billingAddress" or "shippingAddress" - where do I add my new field to the these?

    Thanks
    Andrew

  • #2
    See files:
    client/src/views/fields/address.js
    client/res/templates/fields/address/*

    For experienced developer:

    1. Need to add view parameter to metadata "fields.address"
    Create file custom/Espo/Custom/Resources/metadata/fields/address.json
    PHP Code:
    {
      
    "view""Custom:Fields.Address"


    2. Extend existing address field view. Create file client/custom/src/views/fields/address.js

    PHP Code:
    Espo.define('Custom:Views.Fields.Address''Views.Fields.Address', function (Dep) {
     
     
    detailTemplate'custom:fields.address.detail',

     
    editTemplate'custom:fields.address.edit',

    ... 
    OVERRIDEN METHODS ...

    }); 
    3. Create files:
    client/custom/res/templates/fields/address/detail.tpl
    client/custom/res/templates/fields/address/edit.tpl

    Comment


    • #3
      Steps from 1 to 3 to make it possible to change the view (form) of the address.

      But how to add to the Address some fields, such as house, apartment, etc.?

      Comment


      • #4
        It looks like I handled myself.
        It is necessary to add to the file custom\Espo\Custom\Resources\metadata\fields\addre ss.json some lines:
        PHP Code:
        "actualFields":[
            ...........
            
        "flat",
            
        "house",
            ...........
        ],
        "fields":{
            ...........
            
        "flat":{
            
        "type":"varchar"
            
        },
            
        "house":{
            
        "type":"varchar"
            
        },
            ...........

        ,
        and add some code to client\custom\src\views\fields\address.js like client\src\views\fields\address.js
        Last edited by RGF; 08-11-2016, 07:52 AM.

        Comment


        • #5
          Hi, did you add only the new fileds to the file in custom folder or all adress fields? I have similar topic with person-name. Regards

          Comment

          Working...
          X