Post

3 followers Follow
0
Avatar

How can I access fields within a related item?

I am having trouble with accessing fields within a related item when using PHP and the API.

I am querying, for example, a Deal item that has a related Company item.

I'm confused with the layers of XML to access fields from the related Company.

$company = !empty($deal->fields['company']->values) ? $deal->fields['company']->values[0]->title : "";

I got as far as listing the item title, but if I wanted to get values for another field within the related Company item, is that possible?

At the moment I had to write a separate function to pass the item ID into and do a query for the field info I am after, but it seems like the full info for the related items is returned in the initial query already.

Joshua Hay

Please sign in to leave a comment.

1 comment