Change Entity Name Field Type

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skylabz0rz
    Member
    • Nov 2016
    • 34

    Change Entity Name Field Type

    Hello,

    I have been using EspoCRM for a few months now and absolutely love it! Thank you for an outstanding product and we will soon be purchasing the addons.

    I do have a question regarding the name field for entity. I have created some custom entities but the name field shouldn't be manually entered. I was hoping to make it a number field with a prefix and having the system automatically assign this. I created new fields to do this job, but linking records to other entities results in showing "null" vs. what im looking to display. Is there an easy way to change the name field?

    Thanks!
  • mehdib4
    Junior Member
    • Jul 2018
    • 1

    #2
    you can not change dirrectly datatype of Name field of an entity. However, there is a simple solution you can use
    create a new field number with auto increment
    under entiy manager, a list of entities, over the right side of the enity there is an arrow drop down menu with formula and remove option if it is a custom one
    choose formla and then entersomething similar to this
    name = identifiant;
    where identifiant is the field with auto increment, on every save of this new entity, the name field is going to have idetifiant content
    you can referer to this link for general explanation how to use formula

    Comment

    • yuri
      Member
      • Mar 2014
      • 8440

      #3
      Hi,

      You can change a field type manually.

      Create the file custom/Espo/Custom/Resources/metadata/entityDefs/YourEntityType.php


      Code:
      {
           "fields": {
                "name": {
                       "type": "number"
                }
            }
      }
      "name" is a name of Name field.
      Last edited by yuri; 07-04-2018, 05:57 PM.
      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

      • pmontanez
        Member
        • Dec 2016
        • 81

        #4
        Originally posted by yurikuzn
        Hi,

        You can change a field type manually.

        Create the file custom/Espo/Custom/Resources/metadata/entityDefs/YourEntityType.php


        Code:
        {
        "fields": {
        "name": {
        "type": "number"
        }
        }
        }
        "name" is a name of Name field.
        yuri Will this work with the new Attachment Multiple - Lets say that I currently have a File type field with sustancial records but now I'd like to transform that field into the new Attachement Multiple without losing any prior data - Please advise - thanks

        Comment

        Working...