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
Akanksha sharma 15Akanksha sharma 15 

query to find all case related to the oppotunity can anyone let mw know where i am wrong

select Id,status,Priority,opportunity__r.Name,opportunity__c  from case where id=:Opportunity__c
select Id,status,Priority,opportunity__r.Name,opportunity__c  from case where id=:Opportunity__c

 
Karthik KKarthik K
String oppId = '<<YOUR OPP ID>>';
List<Case> caseList = Database.query('select Id,status,Priority,opportunity__r.Name,opportunity__c  from case where opportunity__c  = :oppId');

 
Alain CabonAlain Cabon
Are you using "Feed" when you add the cases to opportunities?
mukesh guptamukesh gupta
Hi Akansha,

Case and Opportunities are not related to each other , both are related to Account object, so you can fetch account related Cases and opportunity,

not find all case from opportunity, because it's not salesforce standard functionality.


Kindly mark my solution as the best answer if it helps you.

Regards'
Mukesh