User Tasks
What are User Tasks?
User tasks are jobs or tasks that are assigned to a specific user to perform. They can be manually created and assigned by another user or generated by OpenDataDSL as a manual task that needs to be performed based on a specific event happening.
Task categories
A task has a category - there are a number of pre-defined system categories which indicate the nature of the task that needs to be performed. Users can add whatever category they like on a task to be assigned to another user, but it is always best to define a naming convention for your own user tasks to aid navigation.
Pre-defined task categories
The current set of pre-defined task categories are shown in the table below:
Category | Description |
---|---|
Process: Technical Failure | A general technical failure caused a process to fail to execute |
Process: Timed Out | A process timed out and therefore failed |
Process: Extract Failure | An ETL process failed during the extract phase |
Process: Transform Failure | An ETL process failed during the transform phase |
Process: Load Failure | An ETL process failed during the load phase |
Quality: Failure | A quality check was performed and failed, the object was not saved to the database |
Quality: Warning | A quality check was performed and failed, the object was written and a failed quality status was added |
Workflow: Task | A generic manual task in a workflow |
Anatomy of a user task
A task contains the following properties:
Name | Type | Description |
---|---|---|
user | String | The user assigned to the task |
created | Date | The timestamp when the task was initially created |
category | String | The category of the task |
description | String | A descriptive name for the task |
assignedBy | String | The user or system that assigned the task to the user |
complete | Boolean | A flag indicating that the task is complete |
completed | Date | The timestamp when the task was completed |
notify | Boolean | A flag to indicate that the user should be notified by email |
* | Any | You can add any other properties onto the task |
Creating a Task
You can manually create tasks to assign to users as shown in the code snippets below:
- OpenDataDSL
- REST API
// Creating using a basic task
q1 = Task()
q1.category = "Task: Sales"
q1.description = "Send quote to ABC Ltd"
q1.user = "john@example.com"
// Add any custom properties
q1.reference = "ABC123"
// Save to the database
save ${task: q1}
POST https://api.opendatadsl.com/api/task/v1
Authorization: Bearer {{token}}
{
"user": "john@example.com",
"category": "Task: Sales",
"description": "Send quote to ABC Ltd",
"reference": "ABC123"
}
Listing Tasks
- OpenDataDSL
- REST API
// Finding tasks assigned to me
tasks = find ${task} where user=${user:"me"}.email
print tasks
GET https://api.opendatadsl.com/api/task/v1?user=john@example.com
Authorization: Bearer {{token}}
Reading a Specific Task
All tasks are assigned a unique id, when you list the tasks you can see that id and read that specific task using the id.
Example task:
{
"_type": "VarTask",
"_id": "6368dacce8f3186ff70e02b3",
"created": "2022-11-07T10:15:40",
"user": "john@example.com",
"category": "Task: Sales",
"description": "Send quote to ABC Ltd",
"assignedBy": "info@opendatadsl.com",
"complete": false,
"notify": true,
"reference": "ABC123",
"_links": {}
}
- OpenDataDSL
- REST API
// Get a task using the unique id
task = ${task:"6368dacce8f3186ff70e02b3"}
print task
GET https://api.opendatadsl.com/api/task/v1/6368dacce8f3186ff70e02b3
Authorization: Bearer {{token}}
Completing a Task
One your work on a task is complete, you can mark it as complete using the following method.
- OpenDataDSL
- REST API
// Get a task using the unique id
task = ${task:"6368dacce8f3186ff70e02b3"}
// Set the complete flag to true
task.complete = true
save ${task: task}
POST https://api.opendatadsl.com/api/task/v1
Authorization: Bearer {{token}}
{
"_id": "6368dacce8f3186ff70e02b3",
"complete": true
}