==========
on_created
==========

on_created(task)

**domain**: server

**language**: python

**class** :doc:`Task class </refs/server/task_api>`

Description
===========

Use ``on_created`` to initialize the application project task.

The event is triggered when the project 
:doc:`task tree </programming/task_tree>`
has just been created. See
:doc:`Workflow </programming/workflow>`

The ``task`` parameter is a reference to the 
:doc:`task tree </programming/task_tree>`

Example
=======

In the following code a lock is created that will be later used in the 
on_apply event handler of the **Invoices** journal in the Demo application.

.. code-block:: py

    from threading import Lock
    
    def on_created(task):
    	task.invoices_lock = Lock()

See also
========

:doc:`Workflow </programming/workflow>`

:doc:`Task tree </programming/task_tree>`

