-
Error: Only variable references are allowed in dynamic SOQL/SOSL.
Hi all, Got stuck in Batch classes not able to execute, getting system.queryexception - Only variable references are allowed in dynamic SOQL/SOSL.
global class SearchAndReplace implements Database.Batchable<sobject>{
global String Query;
global List<id>allObjIds ;
global SearchAndReplace(List<id>allObjectIds){
allObjIds=allObjectIds;
}
global Database.QueryLocator Start(Database.BatchableContext BC){
query='SELECT Id,Name FROM Sobject WHERE Id in:'+allObjIds;
return Database.getQueryLocator(query);
}
global void execute (Database.BatchableContext BC,List<Account>scope){
for(Account obj:scope){
obj.Name='Algoworks';
}
update scope;
}
global void finish (Database.BatchableContext BC){
}
}
Log In to reply.
Popular Salesforce Blogs
Types of Salesforce Support (Customer Success) Plans You’ll See out in the Wild
Customer success is when the customers can achieve their desired business outcomes by leveraging the Salesforce platform. Providing a suitable customer success plan means providing…
Learn All About Salesforce Industry Clouds
The world today is undergoing a process of extreme digitization that reaches all sectors and industries of society. Undoubtedly, the Covid-19 pandemic was an important…
Benefits of Salesforce Commerce Cloud for eCommerce Business
To stay competitive, retailers realize the importance of incorporating multiple channels into their sales and distribution. In the past 20 years, the number of people…
Popular Salesforce Videos
Salesforce Training Videos For Beginners - 3 | Salesforce Admin Training
This Salesforce Training Video will help us in quotation generation and improve customer communication. Generating proposals can be a drag on sales team productivity. Editing…
How to Establish a Many to Many Relationship in Salesforce?
You can use master-detail relationships to model many-to-many relationships between any two objects. A many-to-many relationship allows each record of one object to be linked…
New Product: RepBlaze on Salesforce AppExchange
Visit on AppExchange: Click Here As a Sales manager, if you deal with 1000’s of inbound and other leads everyday and would love to automate…