function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
TinkuTinku 

Visualforce Page help

Hello all,

 

I am writting a visual force page for the task object, to display some activitives in a different page based on the Subject.

 

This is the error i am getting with my code. Can anyone point me in the rigth direction please:

Error: Compile Error: Illegal assignment from LIST<Task> to LIST<Task> at line 19 column 4

 

 

 

public class MarketingGeniusTasksController
{
       List<Task> tk;
 
 public MarketingGeniusTasksController(ApexPages.StandardController Controller)
   {
 }
 
  Public List<Task> getResults()
  {     
        return tk;
  }
 
 public PageReference gettk()
 {
   String userId=UserInfo.getUserId();
   UserId=userId.Substring(0,15);
   System.debug('UserId=='+UserId);
   tk=[Select Status, Subject, Priority, OwnerId, Owner.Name, WhatId, What.Name, WhoId, Who.Name, Vmail__c, RecordTypeId, LastModifiedDate,   from Task where Subject='Enterprise Marketing Genius Email'];   --> Line 19 error
   return Null;
 }

    Static testMethod void testMarketingGeniusTasksController()
    {
    user testUser=[Select Id from user where ProfileId='00e30000000eFWd' AND IsActive=true Limit 1];
    ApexPages.StandardController sc = new ApexPages.StandardController(testUser);
    System.RunAs(testUser)
     {
      MarketingGeniusTasksController testMGT = New MarketingGeniusTasksController(sc);
      testMGT.gettk();
      testMGT.getResults();
     }  
    }
 }

 

Best Answer chosen by Admin (Salesforce Developers) 
jwetzlerjwetzler

it sounds like you either have a class in your org called "List" or a class in your org called "Task"

All Answers

jwetzlerjwetzler

it sounds like you either have a class in your org called "List" or a class in your org called "Task"

This was selected as the best answer
Bhawani SharmaBhawani Sharma

query also needs to be modified .

 

tk=[Select Status, Subject, Priority, OwnerId, Owner.Name, WhatId, What.Name, WhoId, Who.Name, Vmail__c, RecordTypeId, LastModifiedDate  from Task where Subject='Enterprise Marketing Genius Email'];   --> Line 19 error

 

Comma removed afer the LastModifiedDate field

TinkuTinku

Thank you!

 

I could never have figured that out. There was actually a class named 'Task'.

TinkuTinku

thank you TechForce, for the suggestion. But even without the comma in the SOQL query, it was still giving me the same error. Thanks again!