dynamic enumerator and current selection
1 1

4 posts in this topic

Hey everybody, 

 

while setting up a dynamic-enumerator-action, we noticed, that the information on the currently selected element doesn't help to retrieve an actual object. We always get 'None' as a result. 

 

This is the event, that comes in:

{
  "topic": "ftrack.dynamic-enumerator",
  "source": {
    "id": "c73c09beff154613ba61300782bb836e",
    "user": {
      "username": "TEdelmann",
      "id": "75b59aae-e1bb-11e7-ad88-7ab7a47c9dda"
    }
  },
  "target": "",
  "data": {
    "attributeName": "Briefing_Workflows_00_Maya_Config",
    "sorters": [],
    "filters": [
      {
        "disabled": "True",
        "property": "name",
        "root": "data",
        "initialConfig": {
          "disabled": "True",
          "property": "name",
          "root": "data",
          "id": "ft-dynamicenumerator-2000671-query-filter"
        },
        "id": "ft-dynamicenumerator-2000671-query-filter"
      }
    ],
    "query": "",
    "groupers": [],
    "recordData": {
      "changes": {},
      "entity": {
        "entityId": "883b74ea-132b-11e8-ae79-7ab7a47c9dda_15",
        "entityType": "task"
      }
    }
  },
  "in_reply_to_event": "None",
  "id": "27304c3ea333491fa793b457e91f7966",
  "sent": "None"
}

As you can see, there is given an  entity in 'recordData'. But for some reason, we can't query or get the actual object from it. This is what we tried so far..

 

obj_type = event['data']['recordData']['entity']['entityType']
obj_id = event['data']['recordData']['entity']['entityId']
# obj_id = event['source']['id']
# selected_object = self.session.get('TypedContext', obj_id)
# selected_object = self.session.query('Task where id is "{0}"'.format(obj_id)).first()
selected_object = self.session.query('{0} where id is "{1}"'.format(obj_type, obj_id)).first()

 

selected_object is always None. 

 

any suggestions? How are we supposed to get the current selection, when reacting on 'topic=ftrack.dynamic-enumerator'?

 

 

Alternatively, it would be very helpful, if the information on what is currently selected, coulde be retrieved in a general way (i.e. like session.getCurrentSelection())

 

thanks a lot in advance

 

 

 

Tim

Share this post


Link to post
Share on other sites

Additional information: 

 

We noticed, that the ids look different and we don't know why??

normal ids look like this: '75b59aae-e1bb-11e7-ad88-7ab7a47c9dda'

while the one retrieved here looks something like this: '75b59aae-e1bb-11e7-ad88-7ab7a47c9dda_48'

this '_48' breaks it!

 

PLUS:

 

The 'entityType' given in 'event['data']['recordData']['entity']['entityType']' is not starting with a Capital letter, which breaks it too!

 

 

So if we remove the '_48' and use 'TypedContext' instead of the given type, we're able to query the object. 

 

 

Could anybody give us some more insight here?

 

Thanks again

Share this post


Link to post
Share on other sites

Hi Tim,

Sorry for the confusion on this - you're correct, the id is wrong when accessed from the sidebar. To work around this you can do the following:

if '_' in entityId
	realId, junk = entityId.split('_')

As for the entityType - this is old style entity type from the backend. Instead of using 'task' you would want to use 'TypedContext' on the session:

session.get('TypedContext', realId)

 

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
1 1