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
vickySFDCvickySFDC 

How to write SOQL query to get Campaign information from Account object?

Hi All,

I have requirement  to add a Campaign Button to the Account detail Page then click on Button then genertae Excel report from the Account page that displays columns in report then this relates to Campaign object  that the Account has been a part of:
This report wil be
Header:Accont Name:

Columns:Opportunity,Campaign Name(Campaign),LastName,Status from (Camp.member object) these columns how to fetch query from Account object and disply this value in  report.


Thanks,
vicky
BalajiRanganathanBalajiRanganathan
it will be something similar to below soql
 
SELECT Name, (SELECT Status,Contact.lastName FROM CampaignMembers where contactid != null), (SELECT Name, accountid FROM Opportunities__r where accountid= :inputAccountId) FROM Campaign where id in(SELECT CampaignId FROM Opportunity where accountid=:inputAccountId)