You need to sign in to do that
Don't have an account?
Ian Quah
cant use static reference for sobject fields
If I have some object A, that has fields
B__c has the fields
and C__c has the fields
how would I filter such that I can get all A's where
I basically tried the following but I got an error about sObject
Name(string), B__c (sObject) and C__c (sObject)
B__c has the fields
Name(string), BB__c (string of "Yes", "No" and "Maybe)
and C__c has the fields
Name(string), CC_c (bool)
how would I filter such that I can get all A's where
A.B__c.BB__c == "Yes" and A.C__c.CC__c == true
I basically tried the following but I got an error about sObject
return [ SELECT Id, Name, B__c, C__c FROM A WHERE B__c.BB__c = :"Yes" And C__c.CC__c = :true ];
There are couple of things being wrong in your code:
- For relationship field we should use "__r" in place of "__c".
- : is used for binding variables. So we should avoid : when we are directly comparing the values.
Your code should be modifed as below:Please let me know if you need any further help on this.
Thanks,
Abhishek Bansal.