Change address field, hide or remove province

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ITI
    Junior Member
    • Feb 2020
    • 14

    #1

    Change address field, hide or remove province

    For every instance of an address, the State is displayed, what is the best way to remove or hide that field?
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1881

    #2
    I think you could edit the fied`s json file, but I did not test it. This would be the approach:

    in application/Espo/Resources/metadata/fields go to address.json find

    Code:
    "state": {
    "type":"varchar",
    "trim": true,
    "maxLength": 255,
    "view": "views/fields/address-state",
    "customizationOptionsDisabled": true,
    "pattern": "$noBadCharacters"
    },


    and delete it.

    To get it update safe, create a loder fields under custom/Espo/Resources/metadata and copy the altered file there and leave the original as it is.

    Comment

    • ITI
      Junior Member
      • Feb 2020
      • 14

      #3
      I was happy when I see the file and your reaction, unfortunally not succesful
      I also delete in actualField > "state".
      And clear cache.

      Nothing change.

      Is there more to be needed to change?

      Comment

      • shalmaxb
        Senior Member
        • Mar 2015
        • 1881

        #4
        You are right, I tested right now and it does not remove the "state" field.
        A workaround could be, that you don not use in your Layout Manager the complete address field but the parts of it that will be generated automatically, when using the adress field. Every field of the one address field is also available as single field,

        Comment

        • yuri
          EspoCRM product developer
          • Mar 2014
          • 9967

          #5
          Define a custom view for the address field type. https://docs.espocrm.com/development/custom-field-type/

          In your custom view define custom templates for detail and edit views: https://github.com/espocrm/espocrm/b...address.js#L43

          Define a custom function getFormattedAddress1
          https://github.com/espocrm/espocrm/b...ddress.js#L159

          Assuming you have address format = 1 set in the settings.

          Define a custom fetch function w/o state value fetcing. https://github.com/espocrm/espocrm/b...ddress.js#L639

          Comment

          • juliet
            Banned
            • Mar 2023
            • 1

            #6
            It appears that despite your efforts, the changes you made to the file and cache clearance did not yield the desired results. To troubleshoot further, consider checking other relevant fields, ensuring proper syntax, and confirming that all necessary steps have been followed. If issues persist, seeking technical support or consulting relevant documentation may provide a solution.

            Comment

            Working...