2

I am getting an error "No such column 'name' on entity 'Task'. It is coming from my query but I am not querying for 'name'. Please help.

public list<task> getTasks() {
list<account> myaccs = new list<account>([select id from account where ownerid =: userinfo.getuserid()]);
set<id> aid = new set<id>();
for(account a: myaccs){
    aid.add(a.id);
    }

string sortFullExp = sortfield  + ' ' + sortDirection;
    mytasks = database.query('SELECT subject, status, priority, reminderdatetime from task order by ' + sortFullExp);
    return mytasks;
}

1 Answer 1

4

I bet that the value of 'sortfield' is 'Name'. Use System.debug('sortfield val = ' + sortfield); and see what comes up.

2
  • You are correct. 'Name' was assigned to sortfield.
    – Berg
    Commented Feb 13, 2014 at 19:30
  • If this is the correct answer, could you please mark it as such?
    – dphil
    Commented Feb 13, 2014 at 19:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .