function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BrandonBrandon 

Relationship from Event to Case

Hello,

I'm trying to build a query that finds Events that are tied to Cases and returns some fields from both objects, filtering by the ActivityDate field on the Event object. I don't want to use a Parent-to-Children query -- "Select Status (Select ActivityDate from Events where ActivityDate < 2006-11-10 )"  -- because that would return all Cases, whether or not the "where" clause is true.

Is there a way to do this in one query using the Child-To-Parent relationship?

I tried using the "What" relationship, but that points to a Name object. Is there a way to get it to return a Case object? Or will I have to do a manual join with two relationships?

I dream of querying something like:
"SELECT ActivityDate, WhatId, What.Status from Event"

Thanks,
Brandon
DevAngelDevAngel
Hi Brandon,

After trying several permutations for your query, the limitation is that Name object aspect.  You will need to execute one query and one retrieve and "connect" the results manually.