Skip to main content

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:

CategoryDescription
Process: Technical FailureA general technical failure caused a process to fail to execute
Process: Timed OutA process timed out and therefore failed
Process: Extract FailureAn ETL process failed during the extract phase
Process: Transform FailureAn ETL process failed during the transform phase
Process: Load FailureAn ETL process failed during the load phase
Quality: FailureA quality check was performed and failed, the object was not saved to the database
Quality: WarningA quality check was performed and failed, the object was written and a failed quality status was added
Workflow: TaskA generic manual task in a workflow

Anatomy of a user task

A task contains the following properties:

NameTypeDescription
userStringThe user assigned to the task
createdDateThe timestamp when the task was initially created
categoryStringThe category of the task
descriptionStringA descriptive name for the task
assignedByStringThe user or system that assigned the task to the user
completeBooleanA flag indicating that the task is complete
completedDateThe timestamp when the task was completed
notifyBooleanA flag to indicate that the user should be notified by email
*AnyYou 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:

// 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}

Listing Tasks

// Finding tasks assigned to me
tasks = find ${task} where user=${user:"me"}.email
print tasks

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": {}
}
// Get a task using the unique id
task = ${task:"6368dacce8f3186ff70e02b3"}
print task

Completing a Task

One your work on a task is complete, you can mark it as complete using the following method.

// Get a task using the unique id
task = ${task:"6368dacce8f3186ff70e02b3"}

// Set the complete flag to true
task.complete = true
save ${task: task}