Activity Forums Salesforce® Discussions Cannot Access Campaign Field from Lead Object Record in Salesforce

  • Manpreet

    Member
    April 26, 2018 at 4:44 pm

    Hi pranav,

    This field is not accessible if you query a Lead object using API. User can get the details by querying CampaignMember object through API.
    List<CampaignMember> cms=[SELECT CampaignID, LeadID, Status FROM CampaignMember WHERE CampaignID =: CampaignID__c];
    Set<ID> LeadIDs= new Set<ID>();
    FOR(CampaignMember cm:cms){
    if(LeadIDs.contains(cm.LeadID)==FALSE){
    LeadIDs.add(cm.LeadID);
    }
    }

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos