Announcement

Collapse
No announcement yet.

Alternative foreign field for link field?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #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


    • #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...
      X