You need to sign in to do that
Don't have an account?
Monishan M
System.QueryException: unexpected token: Id
Hi All,
I have below code, when executing receiving the error
System.QueryException: unexpected token: Id
Code
global class RetrieveMedicalInquiryStatusBatchMVN implements Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful, Schedulable {
String query = 'SELECT Id,Account_vod__c, Status_vod__c, MA_Response_AZ__c ' +
// Query Closing
'FROM Medical_Inquiry_vod__c ' +
'WHERE Sent_to_GMIP_MVN__c = TRUE ' +
'AND Status_vod__c IN :statuses' +
'AND Id IN :Ids';
List <String> statuses;
List<String>Ids = new List<String>{'a0t1y0000005QRTAA2','a0t1y0000005QRYAA2'};
Can you please let me know how to correct them
Thanks,
Monisha
I have below code, when executing receiving the error
System.QueryException: unexpected token: Id
Code
global class RetrieveMedicalInquiryStatusBatchMVN implements Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful, Schedulable {
String query = 'SELECT Id,Account_vod__c, Status_vod__c, MA_Response_AZ__c ' +
// Query Closing
'FROM Medical_Inquiry_vod__c ' +
'WHERE Sent_to_GMIP_MVN__c = TRUE ' +
'AND Status_vod__c IN :statuses' +
'AND Id IN :Ids';
List <String> statuses;
List<String>Ids = new List<String>{'a0t1y0000005QRTAA2','a0t1y0000005QRYAA2'};
Can you please let me know how to correct them
Thanks,
Monisha
Space is missing in the AND condition in where clause before id AND.
String query = 'SELECT Id,Account_vod__c, Status_vod__c, MA_Response_AZ__c ' +
// Query Closing
'FROM Medical_Inquiry_vod__c ' +
'WHERE Sent_to_GMIP_MVN__c = TRUE ' +
'AND Status_vod__c IN :statuses' +
' AND Id IN :Ids'; // Add the empty Space here before AND or above line.
Thanks,
Maharajan.C
Hi Monishan M,
The spaces in each concatenated string matters here. You need to add a space at the beginning of each concatenated SOQL string.
Please use the below String query
Tip: Variable names must start with lower case letters. In your case Ids must be the ids or idList.
Thanks,
Amit Aher