function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hermann OuréHermann Ouré 

Error SOQL syntax

Hello,

I am unable to get the correct syntax for my SOQL request
I am trying to request all cases with of a specific record type by using a custom label.
But my syntax is wrong and I cannot quite figure it out.

Thanks
 

Id caseConcernRecordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByName().get(label.Param_Case_Concern).getRecordTypeId();

        Map<Id, Case> caseWithAircallTaskMap = new Map<Id, Case>([SELECT Id, First_Aircall_Logged__c FROM Case WHERE RecordTypeId IN: caseConcernRecordTypeId]);
 


 

Best Answer chosen by Hermann Ouré
Abhishek BansalAbhishek Bansal
Please change query like this:

Map<Id, Case> caseWithAircallTaskMap = new Map<Id, Case>([SELECT Id, First_Aircall_Logged__c FROM Case WHERE RecordTypeId =: caseConcernRecordTypeId]);

IN is used when we have a list to compare.