Jump to content

Print out selected task name

Jason Evanko

Recommended Posts

Hey all! I'm trying to write a quick little action that would print out the selected task name at the top of the page when launched and I'm having some trouble getting that variable and was wondering how I would get that specific one? I'm able to loop through all active projects and get that variable with self.sessions and a for loop with projects but I can't seem to isolate just the active project or any of the tasks inside that project. 



Thanks so much!


Link to comment
Share on other sites

Hi Jason!

What you are looking for is the `selection` variable, I had a little snippet doing something similar that I've modified slightly for you below. It's not complete but it does at least show the concept. Hope this helps!


    def launch(self, session, entities, event):
        selection = event['data']['selection']

        if len(selection) == 1:
            entity = selection[0]
            task = None
                task = session.query(
                    f'Task where id is \"{entity["entityId"]}\"'
            except Exception as e:
                return {
                    'success': False,
                    'message': 'An error occurred.'
            if task:
                return {
                    'success': True,
                    'message': f'Task name: {task["name"]}'

        return False


Link to comment
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
  • Create New...