You need to sign in to do that
Don't have an account?
Possible SalesForce.com Bug?
First off, please read the WHOLE message before replying. Everyone seems to read the error message and stop there... Thanks. :)
So I came across this error when doing something relatively simple and after narrowing it down, it seems to be a problem with SalesForce itsself. First the error:
SELECT id FROM Lead WHERE ((CampaignId = '701xxxxxxxxxxxxx') ^ ERROR at Row:1:Column:29 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.
Here's how to reproduce it.
Apex Page:
<apex:page standardController="Lead" extensions="leadsextension" recordSetVar="leads" id="leadslist"></apex:page>
Apex Class (leadsextension.cls):
public class leadsextension{ private List<Lead> leads; public Integer leadsCount { get; private set; } public leadsextension( ApexPages.Standardsetcontroller stdSetCtrlr ) { leads = (List<Lead>)stdSetCtrlr.getSelected(); } }
Add the page as a custom button to the leads list view, check some leads and click the button. Everything so far works fine. Now the problem. Create a lead view with a campaign as a filter. Load that list, check some leads and click the new button... ERROR! Maybe I'm being stupid and someone can lead me out of the darkness. Help!
Thanks,
Dan
Ah, sorry - I see what you mean - that may indeed be a bug with the Lead Set Controller. I'm pretty sure you can't query directly for CampaignId on the Lead table in Apex, but that's what it appears to be trying to do (there is some specialized functions that let you do that in the UI, but I don't believe they are available in Apex, which might be why you're getting that bug) - I'd raise a case, but in the mean time, you'll probably need to change the extension to query for the leads in the CampaignMember table...
CampaignID cannot be accessed on Lead as it's not a true field in the schema in the usual sense. Query CampaignMember instead to get what you're looking for.
Here's more details from a previous post:
http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=24019
Are you trying to create a custom button using a list controller on Lead that accesses the CampaignID in the List view filter criteria?
If so, I'm pretty sure that the list criteria aren't available in Apex as I'm not even sure they are exposed in the metadata API.
I am trying to create a custom button using a list controller, but not that accesses the campaignId in the list view criteria. Apparently, Salesforce is doing something on the backend that is trying to re-apply the list view filter criteria... Thanks for continuing to help out.
Thanks for the clarification - looks like this might be a bug where the criteria is loaded incorrectly, creating the error.
If you haven't already, file a ticket with support and it should be escalated to my team shortly. In the meantime, we'll look into a root cause & fix.
You guys are awesome. Thanks for taking the time to look into my issue. I have created a ticket. Case # 03200735. It looks like it was last modified by Diego Olarte. Again, thanks for all of your help.
Here is the final result of the correspondence with support on this issue. They have admitted that it is a bug in their system and that the fix will be "targeted for a future patch or seasonal release", which really blows because this application is soon to be posted on Appexchange and there will be lots of SalesForce customers having this issue. Do you guys know of any way to get this pushed through faster?
Thanks,
Dan
Sorry for the delay here. My team's been investigating this for some time now as we didn't want to wait for case escalation to get a solution in the works.
On the high level, we know exactly what the problem is, but the fix is hard so it may take some time. We're working with another team to iron out the details to make sure the cure isn't worse than the bug.
Hi John,
Is there a workaround for this issue?
Thanks and regards,
Ambili
The error surfaces only for Lead list views filtering on a specific campaign so the best workaround I can recommend is avoiding lead list views that filter on campaigns.
Other than that, I can't think of a good workaround as campaign member list controllers aren't available until we enable campaign member list views, which is very high on the marketing roadmap right now.
Hi John,
Thanks. Strangely we are not getting this error since past few minutes. Do you know if any patch has been applied to fix it? This was not working since 1/5 until a few minutes ago.
Is anyone else still getting the error or is it resolved?
Thanks
I just tried it again in one of our customer's systems and the problem is still happening. The best solution that I can come up with to my particular issue is to pass the list of selected records to the controller through Javascript. The only limitation with this is I cannot let them operate on an entire list without checking all of the options.
Thanks for your continuing efforts.
Dan
Any updates on this issue ? Because i am still facing the same issue.
I am running into this issue as well. I am attempting to use the getSelected method from a controller extension to retrieve a list of sObjects selected in a list view. When using the Campaign filter in the list view on Contact (not Lead), I am getting this error on load of my Visualforce page which calls getSelected from the constructor:
system.security.NoAccessException: Object type not accessible. Please check permissions and make sure the object is not in development mode: SELECT id FROM Contact WHERE ((CampaignId = '70160000000BBqR') ^ ERROR at Row:1:Column:32 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.
To be clear, like the original author of this thread, I am not querying for CampaignId, I am not using a SOQL at all in my controller extension. The only method that is causing some behind the scenes query to take place is getSelected().
Should I open a case? I'm quite discouraged to see that this has been a known problem for over a year. I'd love at least a workaround.
Thanks,
Dave