Jump to content

Outgoing_links in tasks not adding up


Simo Virokannas

Recommended Posts

Posted

I'm writing an event handler to perform actions on tasks that are linked from a task through outgoing links. However, I never see anything in the outgoing_links collection for a task. The task that is linked does see the same link in the incoming_links collection.

Using the sample project, I created an outgoing link from "Research & Design" to "Documentation" and can see it as outgoing in R&D and incoming in Documentation.

In my event handler for the "task" event, I have this:

    # this is running inside a callback - session is the current session, entity is a single entity
    
    task = session.get("Task",entity["entityId"])
    print task["name"],task

    print "outgoing links:"
    for link in task["outgoing_links"]:
        print "out",link["from"],link["to"]

    print "incoming links:"
    for link in task["incoming_links"]:
        print "in",link["from"],link["to"]

This yields the following when changing statuses on the two tasks:

Research & Design <Task(31d2294c-6355-11e5-a7c9-42010af0e994)>
outgoing links:
incoming links:

Documentation <Task(8cdb95e0-6359-11e5-bb0d-42010af0e994)>
outgoing links:
incoming links:
in <Task(31d2294c-6355-11e5-a7c9-42010af0e994)> <Task(8cdb95e0-6359-11e5-bb0d-42010af0e994)>

So at least the other task knows about the link, and the IDs match, but the same link isn't visible on the other end. Is there a different way to query outgoing links from a task?

[edit] I'm running the ftrack instance on-premise and it is version 3.5.24.4627

Posted

Hi Simo, welcome to the forums! As an alternative to reseting the session you should be able to refresh the data, either as:

del task['incoming_links']

print task['incoming_links']

Or refresh them like this:

session.populate(task, 'incoming_links')

 

Posted

Thank you, session.populate totally does it.

When populating through that, are the retrieved (other task) objects still possibly coming from a cache, or does that ensure their attributes are refreshed as well - or is it better to do that for each attribute I want to have the latest information for?

 

Posted

The operation does not "cascade" and the attributes on items found in the 'incoming_links' are not automatically refreshed. But you can provide a multiple projections to refresh:

session.populate(task, 'incoming_links, incoming_links.from.status.name')

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...