You need to sign in to do that
Don't have an account?
Prasan6
How to get parent field values using soql for tasks
Hi guys,
I am running a soql query and I need to get parent (custom object's) field values in the sql. My soql is like this
select status, subject, whatid, what.name, what.status__c from task
I get the error
No such column 'status__C' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
how to get the parent field value from task?
Thanks,
Prasanna
I am running a soql query and I need to get parent (custom object's) field values in the sql. My soql is like this
select status, subject, whatid, what.name, what.status__c from task
I get the error
No such column 'status__C' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
how to get the parent field value from task?
Thanks,
Prasanna
Task cannot have master detail relationship. So you cant access CustomObjects field by querying On Task.
do one thing
make set of whatId
Set<Id> customObjectIdSet = new Set<Id>();
for(Task t : [SELECT WhatId,WhoId FROM Task])
customObjectIdSet.add(t.whatId);
Then Query on CustomObjects
List <customObject > customObject List = [Select status__c ,name from customObject where Id IN :customObjectIdSet]
Best Regards,
Amit Ghadage.
Thanks for explaing why it is not possible.
Hi Amit,
Thanks for giving code snippet.
I wanted to avoid two soql, unfortunately because of Task limitations I ended up having two soql.