+ Start a Discussion
Arjun AccentureArjun Accenture 

can some on eplease tell me what is issue with this query ??

select id,OwnerId,Territory_ID__c, Patient__c.Territory_ID__r.Current_TM1_Assignee__c from Patient__c where OwnerId !=Null AND Patient__c.Territory_ID__r.Current_TM1_Assignee__c !=Null AND Patient__c.Territory_ID__r.Current_TM1_Assignee__c =: OwnerId


it is saying "unknow error parsing query"
Ginny MahantGinny Mahant
select id, 
OwnerId,
Territory_ID__c, 
Patient__c.Territory_ID__r.Current_TM1_Assignee__c 
 from Patient__c 
 where OwnerId != Null AND 
Patient__c.Territory_ID__r.Current_TM1_Assignee__c != Null AND 
Patient__c.Territory_ID__r.Current_TM1_Assignee__c = OwnerId
Arpit Jain7Arpit Jain7
Are you trying to run this query in developer console, If so update OwnerId in end with any hardcoded user ID you want to query like below :

select id,OwnerId,Territory_ID__c, Patient__c.Territory_ID__r.Current_TM1_Assignee__c from Patient__c where OwnerId !=Null AND Patient__c.Territory_ID__r.Current_TM1_Assignee__c !=Null AND Patient__c.Territory_ID__r.Current_TM1_Assignee__c ='00511111111'

Let me know for any questions.

Thanks
Arpit
 
Big EarsBig Ears
Arjun,

Do you need to replace the "Patient__c.Territory_ID__r.Current_TM1_Assignee__c" with "Patient__r.Territory_ID__r.Current_TM1_Assignee__c"?

In fact, anywhere where Patient__c is linking to a parent record, it may need to be Patient__r