Change existing field type?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wusy8lqf
    Junior Member
    • Feb 2024
    • 6

    Change existing field type?

    Under the accounts->create, there is a field called "type", that is an "Enum" field type that lists industries. Is it possible to change this to an "Multi-Enum"?

    Some accounts work in multiple sectors
  • item
    Active Community Member
    • Mar 2017
    • 1498

    #2
    Hi,

    1) export account : id and type
    2) delete in entity manager : account -> field -> type
    3) create in entity manager : account -> field -> type ... multi-enum
    4) import the file in point 1)

    don't forget clear-cache rebuild.. and clear browser for be sure.

    multi-enum have a new storage in db since v6 or >...

    try first in a "non production" but that do the trick certainly.
    Someone can confirm ?
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • yuri
      Member
      • Mar 2014
      • 8624

      #3
      Better to create a new field. Enum and multi-enum are incompatible types.

      You can then write a before-save formula script that will take a first value from the multi-enum and write into enum. To preserve existing logic that relies on the enum "type".
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment


      • wusy8lqf
        wusy8lqf commented
        Editing a comment
        That makes sense, thankyou Yuri, it's on my list for tomorrow to deal with!
    Working...