Custom Field Service API

The Custom Field service contains the Templates for Custom Fields for Evidences and Cases for one tenant. These templates contain the Custom Fields that should be shown on creation and on edit of either Evidences or Cases depending on the template Type. Note that removing a Custom Field from a Template will not remove it from a Case or Evidence as long as that field contains a value. The Template also contains renamed Default Fields which is just alternative labels for fields which are in Cases and Evidences by default like Description.

Custom Field Service Interactive Documentation

Examples of using the Custom Field Service

Using a GET request to the Custom Field service, we can see the templates for Custom Fields for Cases and Evidences associated to a tenant:

GET https://dems-dev-api.clearancedev.net/customfieldservice/api/v1/template/{tenantName}

The return will look like this:

[
  {
    "type": "Case",
    "renamedFields": [
      {
        "fieldId": "CadNumberTitle",
        "customName": "INumber"
      },
      {
        "fieldId": "RecordNumber",
        "customName": "TestRecordNumber"
      },
      {
        "fieldId": "IncidentNumber",
        "customName": "TestIncidentNumber"
      },
      {
        "fieldId": "OccurredOn",
        "customName": "Incident Start Time"
      }
    ],
    "customFields": [
      {
        "name": "Area",
        "type": "Text"
      },
      {
        "name": "casetest",
        "type": "Text"
      },
      {
        "name": "casetest2",
        "type": "Text"
      }
    ],
    "lastModifiedUtc": "2021-07-26T15:31:27.4511975+00:00",
    "lastModifiedBy": {
      "firstName": "",
      "lastName": "",
      "username": "[email protected]",
      "principalId": 6001,
      "principalType": "user",
      "kId": "https://dems-dev-keyvault.vault.azure.net:443/keys/genetecdev"
    }
  },
  {
    "type": "Evidence",
    "renamedFields": [
      {
        "fieldId": "DescriptionTitle",
        "customName": "New Description1"
      },
      {
        "fieldId": "TagsTitle",
        "customName": "Tagerinno"
      },
      {
        "fieldId": "Description",
        "customName": "EvidenceDescription"
      },
      {
        "fieldId": "StartTime",
        "customName": "Evidence Start Time"
      }
    ],
    "customFields": [
      {
        "name": "Area",
        "type": "Text"
      },
      {
        "name": "VehicleID",
        "type": "Text"
      },
      {
        "name": "Shift",
        "type": "Text"
      },
      {
        "name": "Agency",
        "type": "Text"
      }
    ],
    "lastModifiedUtc": "2021-07-26T15:32:51.6860126+00:00",
    "lastModifiedBy": {
      "firstName": "",
      "lastName": "",
      "username": "[email protected]",
      "principalId": 6001,
      "principalType": "user",
      "kId": "https://dems-dev-keyvault.vault.azure.net:443/keys/genetecdev"
    }
  }
]

To add or update a Template, you can use a PUT request:

https://dems-dev-api.clearancedev.net/customfieldservice/api/v1/template/{tenantName}

With a JSON body like so, with the type being either "Case" or "Evidence" (See the interactive documentation to see the current supported fieldIds for renaming):

{
  "type": "Case",
  "renamedFields": [
    {
      "fieldId": "string",
      "customName": "string"
    }
  ],
  "customFields": [
    {
      "name": "string",
      "type": "Text"
    }
  ],
  "lastModifiedUtc": "2021-07-26T20:15:22.482Z",
  "lastModifiedBy": {
    "firstName": "string",
    "lastName": "string",
    "username": "string",
    "principalId": 0,
    "principalType": "string",
    "kId": "string"
  }
}