Alternative foreign field for link field?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hi-ko
    Member
    • May 2015
    • 90

    Alternative foreign field for link field?

    When defining a link (belongsTo or hasMany) the name field will be displayed. Is there a way to change the foreign field to show (e.g. the number field)?
    In many cases the name field is not unique.
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    You can add a new field with type "foreign",

    For example Case Number field for Task entity

    "fields": {
    "caseTest": {
    "type": "link"
    },
    "caseNumber": {
    "type": "foreign",
    "link": "caseTest",
    "field": "number",
    "readOnly": true,
    "view": "views/fields/foreign-int"
    }
    },
    "links": {
    "caseTest": {
    "type": "belongsTo",
    "foreign": "tasksTest",
    "entity": "Case"
    }
    }

    Comment

    • hi-ko
      Member
      • May 2015
      • 90

      #3
      Hi tanya,
      thanks for your suggestion. This is what we are already using but ends up in a separate field. Sometimes the users don't want to see the name at all but need the functionality from the link field therfore something like
      Code:
      "fields" : {
          "caseTest" : {
              "type" : "link",
              "field" : "number"
          }
      },
      "links" : {
          "caseTest" : {
              "type" : "belongsTo",
              "foreign" : "tasksTest",
              "entity" : "Case"
          }
      }
      would be great. I created ticket 262

      Thanks
      hi-ko
      Last edited by hi-ko; 10-07-2016, 08:50 AM.

      Comment

      Working...