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
mohan s 37mohan s 37 

how to get opportunities that are not assigned any task

I want to get all opportunities that are not assigned any task from last week and i want to display those opportunity names with command link in visualforce page, when i click those opportunities, opportunity details will be displayed for this scenario i am writing some code. In this code  i am fetching all the tasks whatids and store that ids into another list but it throws error like "Incompatible argument type List<Opportunity> for All method on List<Id>" can any one help me to resolve this error.

my class
public class getoppsoftask {
public date;
    List<Task> oppids=[SELECT Whatid FROM Task];
     List<Opportunity> opplist=[SELECT ID, Name FROM Opportunity WHERE StageName!='Closed'];
   List<id> opids=new List<id>();
Sobjects cannot be handed lists of objects via addAll (even though they can be added objects one at a time through add, and OTHER methods that have sObject lists as parameters can accept object lists).
Both lists must be of the same type.

Try referring to the below :

LIST<Account> aList = new LIST<Account>{new Account(), new Account()};
LIST<sObject> sOjbList = new LIST<sObject>();