Announcement

Collapse
No announcement yet.

Loading Custom View?

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

  • Loading Custom View?

    I am trying to follow along with this forum thread and dev doc to change the display and add a new address field:

    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



    However, when I follow for "Customizing field type" (same in forum and docs) and I refresh the lead or account, I get the following files loaded in the DevTools instead of my custom ones:

    /client/src/views/fields/address.js?_=1617214960188
    /client/res/templates/fields/address/detail.tpl?_=1617214960219

    I thought it would load these since /client/custom/Espo/Custom/Resources/metadata/fields/address.json exists:
    /client/custom/src/views/fields/address.js
    /client/custom/res/templates/fields/address/detail.tpl

    Am I misunderstanding or misapplying something? My address.json file is just as documented:
    Code:
    { "view": "custom:views/fields/address" }
    How can I debug this and get it to load my custom address files?

    Thanks,
    Andrew

  • #2
    You need to create a custom entityDefs file for the target entity ("Lead" for example) and specify there the custom view that you wish to invoke to render the "address" field.

    application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json
    Code:
    {
        "fields": {
            "address": {
                "type": "address",
    [COLOR=#c0392b]          "view": "custom:views/fields/address",[/COLOR]
                "isPersonalData": true
            }
        }
    }
    Clear cache and rebuild.

    The "Lead" entity should display the "address" field now using your custom view class.

    You will need to replicate this step for each entity where you wish to render the "address" field using your custom class.

    Since you are a new user (welcome to the forum by the way ) I suggest that you check this post https://forum.espocrm.com/forum/deve...ange-something , it will help giving you a "road map" for the application structure.
    Last edited by telecastg; 04-02-2021, 05:25 PM.

    Comment

    Working...
    X