You need to sign in to do that
Don't have an account?
rtyanas
In an SOQL statement "where lookupField = 'string" invalid ID field:
In my Database.query() I am passing the string below for custom objects. The field Version_of_Software is a lookup field into another object for validation. When I run the query I get the error:
Version_of_Software__c From API_Document__c where Version_of_Software__c = 'Start ^ ERROR at Row:1:Column:77 invalid ID field: Start Time
Select Id, API_Name__c, Version_of_Software__c
From API_Document__c
where Version_of_Software__c = 'Start Time'
How do I search this object on the lookup field?
RT
Version_of_Software__c From API_Document__c where Version_of_Software__c = 'Start ^ ERROR at Row:1:Column:77 invalid ID field: Start Time
Select Id, API_Name__c, Version_of_Software__c
From API_Document__c
where Version_of_Software__c = 'Start Time'
How do I search this object on the lookup field?
RT
I think you want look for name value in where filter,then the query should be
Select Id, API_Name__c, Version_of_Software__c
From API_Document__c
where Version_of_Software__r.name = 'Start Time'
All Answers
I think you want look for name value in where filter,then the query should be
Select Id, API_Name__c, Version_of_Software__c
From API_Document__c
where Version_of_Software__r.name = 'Start Time'
Thanks for response. I am getting the same error in
Developer Console - Query Editor:
Select Id, API_Name__c, Version_of_Software__c
From API_Document__c
where Version_of_Software__c = 'Start Time'
Version_of_Software__c From API_Document__c where Version_of_Software__c = 'Start ^ ERROR at Row:1:Column:77 invalid ID field: Start Time
You are still using the same query,try the below one :
Select Id, API_Name__c, Version_of_Software__c
From API_Document__c
where Version_of_Software__r.name = 'Start Time'
Yes, that was it. I am using the same name in the field as the look up object and thought I was searching based on lookup value.
If the lookup field was Ver and the lookup object was Version would this work?
Select Id, API_Name__c, Version_of_Software__c
From API_Document__c
where Ver = 'Start Time'
Or do I still need to use the lookup object:
Select Id, API_Name__c, Version_of_Software__c
From API_Document__c
where Version.name = 'Start Time'