-
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
Integration Using Named Credentials | Salesforce Developer Guide
The Following are the Benefits of Using Named Credentials: A Named credential specifies the end URL of the callout and its verification parameters required in…
How Salesforce Pardot Derives Your Sales Engagement?
Sales are a crucial aspect of every business, and now with the advent of social media and other online platforms, you not only have to…
Top New Salesforce Winter ’20 Features
Salesforce is back with Winter Release. Every year, Salesforce announces three releases packed with features that enhance the Salesforce experience for the admins, developers, and Salesforce users.These…
Popular Salesforce Videos
Salesforce Multi-factor Authentication/Two-factor Authentication End User Training Video
Watch this video to learn all about Salesforce Multi-factor Authentication/Two-factor Authentication. This is a training video. Watch and learn.
4 Myths About Salesforce
Salesforce is a platform that helps businesses track the journey their customers take. It can help you effectively track and monitor your marketing and sales…
Salesforce Customer 360 Data Manager
Salesforce Customer 360 Data Manager is a cross-cloud integration capability that allows Salesforce admins and developers to combine and reconcile customer data from their Salesforce…