+ Start a Discussion
Soujanya_CG123Soujanya_CG123 

Vote Object not Accessible in CS1

Hi,

 

I am not able to create vote object in trigger or apex class to retreive records.

I am trying to fetch the records from Vote Object as shown below..
Vote[] vote = [select id, createdById from Vote];

I am getting an error message like this
Illegal assignment from LIST:SOBJECT:Vote to Vote

If we get records into SObject, we are not able to convert SObject to Vote.

This problem we are facing in sandbox(cs1).

 

 

Thanks,

Soujanya.

SuperfellSuperfell
You have your apex class called Vote, which is taking precense over the system provided Vote type, you'll need to either rename your Vote class, or use the fully qualified names.
Vijay RautVijay Raut

Hi,

 

Which version of API you are using? Also can you try to change "vote" Variable name. like -

 

Vote[] voteList = [select id, createdById from Vote];

 

Cheers,

V.R.

Soujanya_CG123Soujanya_CG123

Hi, 

 

I am using apex class with name cgIdeaDetails.

 

 

Thanks,

Soujanya.

 

SuperfellSuperfell
right,but somewhere there's an apex class called Vote, that's causing this, just use the fully qualified version of the db vote object. (check the docs)