+ Start a Discussion
xpresslanejxpresslanej 

No such column 'CampaignId' on entity 'Lead'

I built a VF page to override the change lead status functionality. We require that a Reason Rejected field value is selected when setting the Lead Status = Rejected so I dynamically render the Reason Rejected when Rejected is selected from the select box. Everything works great...except when the user presses the button from a lead list view that is filtered by a Campaign. When they attempt to do so, instead of seeing my custom page, they get something like:

 

LastName, status FROM Lead WHERE ((CampaignId = '701T00000001cZo') ^ ERROR at Row:1:Column:83 No such column 'CampaignId' on entity 'Lead'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 

My VF page references the standard Lead controller. Do I really need to create a custom controller just to make this work?

 

MajMaj

CampaignId isn't a field in Leads. You have to query the CampaignMember object instead...

 

 

hth

m

SiriusBlackOpSiriusBlackOp

I just bumped into this.  This has got to be a SFDC BUG or oversight.

 

This is caused from the View... and ONLY the VIEW.  Most of us know that the CampaignId field is a fake field and doesn't really exist for most purposes... BUT if you create a view using the built-in "Filter By Campaign (Optional):" functionality in salesforce views... then it's Their Job to deal with it and pass back the list of Leads to our VF Pages.  It's their code that is erroring.

 

I'm getting this error and not anywhere in my code to I reference or even care about the Campaign.  I just need FirstName, LastName and ID... and I'm not even using a controller extension or anything... just a VF Page.

 

To reproduce, Create a simple VFPage like this:

<apex:page standardController="Lead" recordSetVar="Ls">

    <apex:repeat value="{!selected}" var="SelectedLead">

        {!SelectedLead.ID}<br/>

    </apex:repeat>

</apex:page>

 

Create a Lead List View Button linked to that page and put it on the Search Layout.

 

Create a View and select a Campaign to filter on in the "Filter By Campaign (Optional):" lookup field.

 

Run the view, select some records and click your button.  Boom... blows up with the error in the first post.

 

Salesforce should still be able to get you the list of leads form this view.  There's really no excuse.

 

SiriusBlackOpSiriusBlackOp

FYI: To any others looking at this issue.

 

Bug Confirmed by Salesforce Support.

 

Is scheduled to be fixed in a future release.  No indication as to which release though.

Seema ASeema A

Hi ,

 

Is this bug got fixed ?  Because I am still facing this issue with Contact filter.

 

Getting this error "currencyisocode, id FROM Contact WHERE ((CampaignId = '70160000000KpbI')) ^ ERROR at Row:1:Column:49 No such column 'CampaignId' on entity 'Contact'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names."