-
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
Salesforce Integration : Streamlining Administrative Processes
In the dynamic world of business and education, administrative efficiency plays a vital role. Institutions, big or small, educational or corporate, require structured processes to…
Introducing Tableau+: The Ultimate Guide for Seamless Tableau Implementation
Deep dive into Tableau CRM, now rebranded as Tableau+. Whether you’re new to Tableau or looking to enhance your existing setup, this blog will cover…
Tips On How To Choose The Best Among The Salesforce Consulting Companies
Do you wish to deliver unparalleled customer services which can constantly increase your business bottom line? This is one thing that you can achieve only…
Popular Salesforce Videos
Crash Course on Apex Triggers Salesforce | Complete Guide with Real Time Scenarios
Complete guide on Apex Triggers Salesforce 0:00 Intro 0:33 Is Triggers difficult to Learn 0:50 What is Trigger? 3:03 What are Trigger events? 11:55 How…
Streamline Sales Goals and Add Value to Your B2B Organization With Salesforce Marketing Automation
Salesforce Marketing Automation enables businesses to automate marketing processes, track customer engagement while delivering personalized experiences to each customer. With it, you can streamline and…
Customer Overview: How Our Customer Used Salesforce Industries i.e Vlocity For It’s Business?
Let's have a glance at our customer success story to understand what is Salesforce Industries in detail. Watch this video and do let us know…