Naming of custom entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tziere
    Member
    • Jul 2020
    • 42

    Naming of custom entity

    Hi!

    I've created a custom entity (requests). I am not using the "name" field, but instead I've created some other fields.
    See attached image: when I create a "request" entry, it generates a random id (5f17ee7fb8e0c32a3) as the name of that entry. I want to use the ReqID (REQ-00002) as its name. How can I do this?
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hello,
    Well, first you need to make sure that the standard name is not required (Administration -> Entity Manager -> Requests -> Fields -> Name -> required box). After, you need to add the ReqID filed to the list view and make it 'link' to be able to enter to the entry by clicking on this id (Administration -> Layout Manager -> Requests -> List -> drag and drop the ReqID filed to the list view -> press the appeared pencil button on this field -> tick the 'link' box).

    But note. Using this way you will face the next problem. All logic in the system uses the 'name' field value for these links (relationship fields). To force the system use the ReqID field instead of the Name field, you need to rewrite the system code.

    As a workaround I suggest you to do this:
    1. Open Administration -> Layout Manager -> Requests -> List/Detail -> remove from the layouts the the ReqID field and put back the Name field.
    2. Open Administration -> Entity Manager -> Requests -> Fields -> name -> change lable from 'Name' to 'ReqID'.
    3. Open Administration -> Entity Manager -> Requests -> Formula -> add formula to store the ReqID autogenerated field value into the 'name' field:
    Code:
    name = reqId;

    Comment

    • Tziere
      Member
      • Jul 2020
      • 42

      #3
      Thank you, works flawlessly!

      Comment

      Working...