-
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
Working and Usage of lightning:recordEditForm | Salesforce Developer Guide
Build a form with the lightning:recordEditForm component to add a Salesforce record or change fields in an existing record. The part shows fields along with…
Five Common Misconceptions About Salesforce Person Accounts
Salesforce is most popular for its administration position in B2B, however it additionally offers incredible arrangements in B2C and for our clients who offer to…
How to Integrate Salesforce With Social Media Channels
More than 60% of the world now uses social media and has active profiles on more than six social media platforms. Social networks have long…
Popular Salesforce Videos
Financial Services Cloud – Release Readiness LIVE, Summer '19
Hear about some of the new and exciting features that you can expect from Financial Services Cloud in the Summer '19 Release. Highlights include: -…
Get Lookup Data From Salesforce Using Relationship Queries
Watch this video to learn how you can create a smart query that will make the lookup show only part of the data.
Salesforce Pardot Basics - A Comprehensive Guide (2021)
In this short video, we will cover the basics of Salesforce Pardot Pardot by Salesforce is a demand generation and marketing management tool by Salesforce.…