Inbound API Custom Fields - TechnicheGroup/urgent-rest GitHub Wiki
In Urgent there is the option to add Custom Fields to a Task, a Site and Assets that are additional fields that the Tenant wants answered on top of the default list of questions or properties. These can change based on a number of factors like the Reactive Matrix, Site Channel and may change from one task to another depending on what type of process you're trying to complete. It is good practice to regularly check (perhaps once a week) the Custom Fields responses to take in new, updated and deleted fields.
On top of the standard Custom Fields that appear during the Task, Site and Asset creation there are also fields which are used in a more structured format and are intended to provide more details about what happened during the lifecycle of the Task. These are called Compliance custom fields.
If you do not provide the correct Custom Fields in your requests you should be prompted with a list of Broken Rules which should identify which fields are missing.
Custom Fields
GET /customfields/{type}/{tenant}/{identifier}
This method returns a list of the Custom Fields which may need to be answered for the provided type of task, asset, site or compliance (special case, see Compliance Custom Fields). The identifier variable is the Matrix Code from the lists in the Matrix By Type method an changes depending on the type you are requesting.
Asset = Asset Matrix Code
Task = Reactive Matrix Code
Site = Site Channel Matrix Code
The response should contain the name of the Custom Field which you will need to pass in as part of the details, the translated text of the question, any parent/child relationships between the questions and what data type you should pass in as the answer.
Example response
"CustomFields": [
{
"Name": "Custom_Question_1",
"Text": "Has the site been cleared of rubble?",
"IsMandatory": false,
"Parent": {
"Name": "",
"TriggerValue": ""
},
"Answer": {
"DataType": "Boolean"
},
"AnswerList": []
},
{
"Name": "Custom_Question_2",
"Text": "What is the time the incident occurred?",
"IsMandatory": false,
"Parent": {
"Name": "",
"TriggerValue": ""
},
"Answer": {
"DataType": "DateTime"
},
"AnswerList": []
},
{
"Name": "Custom_Question_3",
"Text": "Any other comments?",
"IsMandatory": false,
"Parent": {
"Name": "",
"TriggerValue": ""
},
"Answer": {
"DataType": "Text"
},
"AnswerList": []
},
{
"Name": "Custom_Question_4",
"Text": "Fault",
"IsMandatory": true,
"Parent": {
"Name": "",
"TriggerValue": ""
},
"Answer": {
"DataType": "List"
},
"AnswerList": [
"Option 1",
"Option 2",
"Option 3",
"Option 4"
]
}
]
}
Compliance Custom Fields
/customfields/compliance/{tenant}/compliance/{matrixcode}/{workflow}/{status}
Compliance Custom Fields are a special set of Custom Fields and are answered when a Task changes status and the Tenant requires you to complete further details on the task. These are always Reactive Task based fields. The matrixcode variable is the Matrix Code from the main Matrix assigned to the Task and can be found by using the Matrix By Type methods. The workflow variable is the name of the Workflow (example: Reactive Workflow is Reactive%20Workflow) that the Task is assigned to in your local language and the status variable is the name of the status you're attempting to move the Task into in your local language.
Example response
"CustomFields": [
{
"Name": "Compliance_Question_1",
"Text": "Has the area been left clean and tidy?",
"IsMandatory": false,
"Parent": {
"Name": "",
"TriggerValue": ""
},
"Answer": {
"DataType": "Boolean"
},
"AnswerList": []
},
{
"Name": "Compliance_Question_2",
"Text": "When was the last time you completed a safety certificate?",
"IsMandatory": false,
"Parent": {
"Name": "",
"TriggerValue": ""
},
"Answer": {
"DataType": "DateTime"
},
"AnswerList": []
}
]
}