Custom field type with data from multiple fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agudek
    Junior Member
    • Aug 2018
    • 4

    Custom field type with data from multiple fields

    Hi,

    I am trying to create a field view that will display values of multiple fields of a record. After some digging through the code I decide that the best way to do this would be to create a custom field type in which I can define the database fields to be obtained from the API. I have already created a JS view definition file and a template file, but am having some trouble fetching the required fields from the API.

    I created a JSON definition for a new field type as follows:

    Code:
    {
      "view": "custom:views/contact/fields/credits",
      "actualFields": [
        "lessonCredit",
        "usedLessonCredit",
        "examCredit",
        "usedExamCredit"
      ],
      "notMergeable": true,
      "notCreatable": true,
      "filter": false,
      "skipOrmDefs": true,
      "fieldDefs": {
        "notStorable": true,
        "readOnly": true,
        "layoutMassUpdateDisabled": true,
        "layoutFiltersDisabled": true,
        "exportDisabled": true,
        "importDisabled": true,
        "textFilterDisabled": true,
        "isCustom": true
      }
    }
    Then, I placed the following definition in entityDefs:

    Code:
    "Credits": {
            "label": "Credits",
            "type": "credits"
          }
    Now the problem that I have is that the API URL is created as api/v1/...%2CCreditsLessonCredit%2CCreditsUsedLessonCredi t%2CCreditsExamCredit%2CCreditsUsedExamCredit, so the name of the definition in entityDefs is prepended to the field names defined in the JSON file. I noticed that some field types used the field "naming":"prefix" and that this field could contain the values "prefix", "suffix" and "actual", but adding "naming":"actual" to the JSON definition displayed the same results as before. How can I make it so that the created API URL uses the field names in actualFields as is without adding something else to it?

    Also due to a lack of very detailed documentation I have actually no idea what most of the fields defined in the JSON file actually do. Is there any place where I can read up on all possible fields and values, and their uses?
  • mr2d2
    Senior Member
    • Apr 2017
    • 126

    #2
    Actually for me too. Help please

    Comment

    Working...