How to call values from another page in ShotGrid

Hi, I’m trying to make an Event Daemon in Shotgrid that does the following:

In the ‘Version’ page, Looks at 3 different fields: “Link > Asset > Episodes”, “Link > Shot > Sequence > Episode”, and “Link > Sequence > Episode” and if one of them contains a value, then fill in the “Episode” field with that value found in one of the three fields, like the below picture; I want the “Episode” fields to be filled with the ‘101’ values since one of the 3 fields contains that value:

But my problem is that the 3 aforementioned fields aren’t recognized as part of the Version’s fields (I’m guessing it’s because they’re from other pages like ‘Assets’ and ‘Shots’) and so I’m having trouble looking at those fields and retrieving the value from the fields.

How do I retrieve those values and put them in the “Episode” field in the Versions?

Some help and even a sample code would be much appreciated…

These are linked fields, which exist on a different entity.
There are several options:

you can refer to transitive fields from the given entity e.g. from the Version search for entity.Shot.sg_sequence.Sequence.episode. Note how first is the field name (entity) and then the field class (Shot). There are some examples of this in the api documentation.

Another option is to perform multiple searches, e.g. for this version give me the entity. From the entity search for the sequence. From the sequence search for the episode.

1 Like

Your first solution seems to have done the trick!

Thank you.

It really depends on the situation which approach to use. For instance, you might need just one episode shared among all shots (or something) - then you might as well fetch it once at the start.