I'm hoping someone can give me a pointer on narrowing my returned entries on the basis of nested playa parent relationships. Here's the scoop:
I have a 4 inter-related channels: companies, people, tasks and task statuses. Companies are at the top of the food chain - a lot of the display of the entries in my channels is determine by the company.
People are assigned to companies. When the user logs in, their parent company is stashed as a site variable (member_company_id).
Tasks are assigned to companies, and tasks may be shared with multiple companies since they are one central list of tasks. Tasks therefore have a playa relationship field assigned to the companies channel. On the home screen, when the user logs in, they need to see the list of tasks assigned to their company.
So far, all of the above works nicely with playa parents. Where I'm having trouble is the next layer.
My task statuses channel includes 2 playa fields - one for related company and one for related task. The idea being that each company will be assigning a "status" to each task they have been assigned. But because the task itself is not exclusive to the company, the task status must be an entry whose display is based on both relationship fields at the same time. I thought that the relationship to companies would cascade down through the nested parent chain, but I'm discovering that they are not. Here's my template code:
{exp:stash:get_list name="member_details" limit="1"}
{exp:channel:entries channel="comp" limit="1" entry_id="{member_company_id}" orderby="date" sort="desc" disable="member_data|pagination" dynamic="no" cache="yes" refresh="720"}
{!-- FETCH TASKS ASSIGNED TO CURRENT LOGGED IN MEMBER COMPANY --}
{exp:playa:parents channel="tasks" field="cf_tasks_related_companies" var_prefix="tasks"}
<div class="row">
<div class="large-8 columns">
<h5>{tasks:title}</h5>
<p class="smaller">{tasks:cf_tasks_description}</p>
</div>
<div class="large-4 columns">
{!-- FETCH STATUS OF EACH TASK --}
{tasks:exp:playa:parents limit="1" channel="status" field="cf_status_related_task" var_prefix="status"}
{if status:no_parents}<a href="#" class="button tiny secondary" data-reveal-id="updateStatusModal">Add Status</a>{/if}
<div class="smaller" style="margin-bottom: 1.0em;">
<div>Status: {status:cf_status_current:label}</div>
<div>Target: {status:cf_status_target_date format="%M %d %Y"}</div>
</div>
<p><a href="#" class="button tiny secondary" data-reveal-id="updateStatusModal">Update Status</a></p>
{/tasks:exp:playa:parents}
</div>
</div>
{/exp:playa:parents}
{/exp:channel:entries}
{/exp:stash:get_list}
What I'm finding is that when I log in as a member of company XYZ, I correctly get the tasks assigned to that company. However, the task statuses being returned by tasks:exp:playa:parents are not limited to the company and instead I'm getting all task statuses assigned to task A.
Is there a way to limit the returned entries in the fashion I am looking for with the nested parents tags, or am I going to need a custom query?
cf_status_related_company
field and this Task selected in thecf_status_related_task
field"?