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
CloudComputingSFDCCloudComputingSFDC 

SOQL Question Help needed.

Parent object : Activity

Child Object : Claim (status is field in claim which can have values Cancelled / Closed).

 

Get all activities in SOQL for which all claims are closed / Cancelled.

 

Thanks

 

skodisanaskodisana
Hi,
Please try the following query.
Select (Select Status From Tasks where Status='Completed') From [CustomObject__c]

Thanks,
Srikanth. K
CloudComputingSFDCCloudComputingSFDC

I am concened with checking of all records. exp:- there are 10 records in the object out of which 7 are cancelled / Closed then it will give me 7 records but I want query to give me 0 records as all 10 are not cancelled / Closed. (Need to check all records) 

IspitaIspita
Even before I start answering your query.
Here are few concerns:-
1.Is the Activity object referred by you the standard SFDC object?
2. If yes- then you cannot assign Activity as a parent of any object rather Activity/ Task cannot be linked by any relationship Master or lookup to any other object.
3. If no that is Activity is a custom object then - then if they linked by master-detail relationship then perhaps by using rollup summary fields ( one counting claims and other counting only claims which are closed) will enable you to get all the "Activity" in a simple query where "Count all claim" = "Count closed claim" ..
Do let me know if resolves your issue.
Thanks