You need to sign in to do that
Don't have an account?
Shatrughna Salunke
Invalid IN fields group: PERSONEMAIL OR Custome_Email__C
Hello,
Is there any aletrnative way to achive the below sosl and soql error?
For the below code I am getting error
Error : Invalid IN fields group: PERSONEMAIL OR Custome_Email__C
@AuraEnabled
public static List<Account> getData(String entityType)
{
List<account> getDetails=new List<account>();
List<List<Account>> accList = [FIND : entityType IN PersonEmail Fields RETURNING Account(id,PersonEmail) limit 1];
for(List<Account> accountList1 : accList){
for(Account accountList2 : accountList1){
if(accountList2.PersonEmail != null )
{
if((accountList2.PersonEmail).equalsIgnoreCase(entityType) )
{
getDetails.add(accountList2);
}
}
}
}
return getDetails;
}
}
Also,getting error for this soql as well
[Select id,PersonEmail from Account where PersonEmail =:emailIds]
Error: we canot filter query for PersonEmail
Note: passing email id' from aura method and need to be filter record based on the email id's
Is there any aletrnative way to achive the below sosl and soql error?
For the below code I am getting error
Error : Invalid IN fields group: PERSONEMAIL OR Custome_Email__C
@AuraEnabled
public static List<Account> getData(String entityType)
{
List<account> getDetails=new List<account>();
List<List<Account>> accList = [FIND : entityType IN PersonEmail Fields RETURNING Account(id,PersonEmail) limit 1];
for(List<Account> accountList1 : accList){
for(Account accountList2 : accountList1){
if(accountList2.PersonEmail != null )
{
if((accountList2.PersonEmail).equalsIgnoreCase(entityType) )
{
getDetails.add(accountList2);
}
}
}
}
return getDetails;
}
}
Also,getting error for this soql as well
[Select id,PersonEmail from Account where PersonEmail =:emailIds]
Error: we canot filter query for PersonEmail
Note: passing email id' from aura method and need to be filter record based on the email id's
Guess the error you are seeing with your SOSL is expected though because In SOSL you can't search by string value of a Lookup field.
For Example:
Record in object Contact:
Name: David Sidhu
Now there's a related object "LookUpToContact" looking up to parent object Contact.
Try to search "David Sidhu" using SOSL in LookUpToContact Query:
String searchName = 'FIND {David*} IN ALL FIELDS RETURNING LookUptoContact__c(Id, Contact__r.FirstName)';
Returns nothing, just an error (can be verified using workbench).
https://help.salesforce.com/articleView?id=000176100&type=1
All Answers
Guess the error you are seeing with your SOSL is expected though because In SOSL you can't search by string value of a Lookup field.
For Example:
Record in object Contact:
Name: David Sidhu
Now there's a related object "LookUpToContact" looking up to parent object Contact.
Try to search "David Sidhu" using SOSL in LookUpToContact Query:
String searchName = 'FIND {David*} IN ALL FIELDS RETURNING LookUptoContact__c(Id, Contact__r.FirstName)';
Returns nothing, just an error (can be verified using workbench).
https://help.salesforce.com/articleView?id=000176100&type=1
For SOSL problem has been resolved, but stil I'm getting error for soql. is there any setting for this soql?.
Error: