Event listener - Require timelog comments
2 2

4 posts in this topic

Hi,

I've created an event listener to require comments when logging time on certain tasks, and thought I should share it with the community. It shows the usage of triggering and handling an actions UI based on an event. Please let me know if you have any comments or feedback.

 

You can find the snippet on bitbucket.

 

Event listener: Require timelog comments
The event listener can be used to require comments when logging time against certain tasks from the ftrack interface. The event listener will trigger an Action UI to require timelog comments if the custom attribute require_comments is set on the timelog context.
 

Configuration

You can configure the following in the script:

REQUIRE_COMMENTS_ATTRIBUTE
    The name of the custom attribute, that can be used to control if a task requires timelog comments.

 

Running the event listener

You can run the event listener from the command line::

python require_timelog_comments.py

You can also register the event listener as a plugin. For more information, see the links below.

Quote

You can use something like Supervisor or Monit to monitor and ensure the event listener is always running.

 

Read more

Find more information in our documentation:

* Developing: Events
* Event: Action - trigger interface
* Event: Update
* Tracking time
* Python API: Configuring plugins
* Python API: Environment variables

Share this post


Link to post
Share on other sites

Hi Lucas,

 

thanks for sharing it.

 

During the tests I face some issues: if the custom attribute REQUIRE_COMMENTS_ATTRIBUTE changes on the task while the event is running, the event still uses the initial value. How can we fix it?

I have the same issue if I would like to query the project period for eg.

I use ftrack-python-api-1.0.1 and ftrack-api-3.3.34.

 

Regards,

Laura

 

Share this post


Link to post
Share on other sites

Thanks for raising the issue Laura.

I've confirmed the behaviour, and have no good workaround at this point.

A brute-force solution would be to call `session.reset()` on line 57 of the snippet, but this is far from optimal and will discuss this with the team to see if we can find a long term solution to this.

Regards,
Lucas

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
2 2