I try to fetch the lead records as List<Lead> ld=[Select id,name,Campaign from lead];

but I am unable to fetch the records. it showing an error

ERROR:-No such column 'Campaign' on entity 'Lead'

please help me to resolve that

marked as duplicate by sfdcfox apex Apr 18 at 4:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • that means we can't get 'Campaign' with a lead query. is there any possibility – SFDC V Apr 18 at 4:52
  • You have to query the CampaignMembers related object. – sfdcfox Apr 18 at 11:33