You need to sign in to do that
Don't have an account?
maiyaku
Database Query this error unexpected token
caused by: System.QueryException: unexpected token: '('
Public MD_Sales_Group_Initials__c getMSGI(List<ID> SalesRepName){ String MSGIQuery = ''; List<MD_Sales_Group_Initials__c> lstMSGI = New List<MD_Sales_Group_Initials__c> (); MD_Sales_Group_Initials__c MSGI = New MD_Sales_Group_Initials__c (); MSGIQuery = 'Select id,Name,Code__c From MD_Sales_Group_Initials__c Where ID In (' + SalesRepName + ')'; List<sObject> Qmsgi = Database.Query(MSGIQuery); if(Qmsgi != null && Qmsgi.size()>0){ for(sObject s: Qmsgi){ lstMSGI.add((MD_Sales_Group_Initials__c)s); } } if(lstMSGI != null && lstMSGI.size() > 0){ MSGI = lstMSGI[0]; } Return MSGI; }
MSGIQuery = 'Select id,Name,Code__c From MD_Sales_Group_Initials__c Where ID In (' + SalesRepName + ')';
Thank you.
MSGIQuery = 'Select id,Name,Code__c From MD_Sales_Group_Initials__c Where ID In (' + SalesRepName + ')';
Try using
MSGIQuery = 'Select id,Name,Code__c From MD_Sales_Group_Initials__c Where ID In : SalesRepName '
All Answers
MSGIQuery = 'Select id,Name,Code__c From MD_Sales_Group_Initials__c Where ID In (' + SalesRepName + ')';
Try using
MSGIQuery = 'Select id,Name,Code__c From MD_Sales_Group_Initials__c Where ID In : SalesRepName '
Actually is there a reason you are not using Set<Id> as you arguement to the method? Change it to Set<Id> and use the previous recomendation.
OK this work but new ploblem
Too many SOQL queries Limit 201
It hard ploblem