You need to sign in to do that
Don't have an account?
sparky
SOQL on CampaignMemberStatus fails in apex class?
Not sure if this is a bug or my error, I of course assume the latter until proven guilty.
I've got an apex class I'm building in eclipse. Not much going on yet, here's what it looks like so far:
Code:
* the SOQL query works in testing if I replace the variable w/ an Id
* the line as written seems to compile if pasted into a trigger (not a class)
* the class as written compiles if I chg the line into a query on another object (like Contact) instead of CampaignMemberStatus
Is there some restriction to using CampaignMemberStatus in a class? Or did I just screw up somewhere?
Thanks!
I've got an apex class I'm building in eclipse. Not much going on yet, here's what it looks like so far:
Code:
Public Class CampaignMemberStat{ Public Static string GetRespondedStatus (Id campId) { // for a given campaign, look up the 'default' status to use for Responded CampaignMemberStatus[] cStatus = [Select c.Label, c.IsDefault From CampaignMemberStatus c WHERE c.CampaignId = :campId ORDER BY c.HasResponded desc, c.IsDefault desc]; } }When I attempt to compile this, i get an error "Illegal assignment from LIST:SOBJECT:CampaignMemberStatus to LIST:CampaignMemberStatus" on the line w/ the SOQL. I've checked and don't see anything wrong w/ my syntax. It's also true that:
* the SOQL query works in testing if I replace the variable w/ an Id
* the line as written seems to compile if pasted into a trigger (not a class)
* the class as written compiles if I chg the line into a query on another object (like Contact) instead of CampaignMemberStatus
Is there some restriction to using CampaignMemberStatus in a class? Or did I just screw up somewhere?
Thanks!
I had originally thought of that, had named the class w/ a reserved word to start. But then I renamed it via eclipse and figured that couldn't be the problem after that. But turns out the eclipse rename function does not in fact rename the code class in SFDC. So the problem still existed.
So I guess you need to physically remove the class, then recreate it w/ the new name?
I've also sinced upgraded my apex toolkit to the latest version, so maybe that was the problem.
I've made same mistake.
LOL