-
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
Where is Salesforce DevOps Heading? Is it the Future, and if so How?
Salesforce DevOps is distinct. It enables efficiency and collaboration among shareholders that some other platforms just cannot provide. It’s not as if DevOps is extremely different from…
An Overview of Salesforce Einstein Analytics
In this top blog on Salesforce, we will be discussing Salesforce Einstein Analytics and what it is, how it works, and more. Salesforce Einstein Analytics…
Fast Track your Marketing Activities and Enhance User Experience with DemandBlue's Salesforce Marketing Cloud Accelerators
Salesforce Marketing Cloud is one of the most used digital marketing platforms. DemandBlue’s set of Marketing Cloud and Pardot accelerators are uniquely backed by a decade of…
Popular Salesforce Videos
Introduction to Salesforce Marketing Cloud
Hello Everyone, In this video, by Amit Singh, we will talk about the basic introduction of the Marketing Cloud in Salesforce. Watch the video and…
Web Chats In Salesforce | Service Cloud | Kanika Chauhan
Salesforce Web Chat (previously known as Salesforce Live Agent) is a feature that allows customers to communicate with the company via the web through instant…
Custom Portfolio in Salesforce | Mini Project | Salesforce Tutorials
In this video, we will create a custom portfolio in Salesforce. We will create a custom community in Salesforce and customize it to create the…