Dynamic SOQL ( queryBinds ) || Salesforce
- Lakshmi Deepak Inkurthi
- Jan 20, 2024
- 1 min read
Dynamic SOQL refers to the creation of a SOQL string at run time with Apex code. Dynamic SOQL enables you to create more flexible applications. For example, you can create a search based on input from an end user or update records with varying field names.
In general we write advance / dynamic query something like this
sObject objectRecord = Database.query('SELECT Id , Name FROM Account LIMIT 1');if it is for collection then something like this
List<sObject> objectRecord = Database.query('SELECT Id , Name FROM Account');But in Spring'23 we got new update from salesforce i.e query Binds, with the help of query binds we can pass the dynamic query variable reference without any query scope limits
With Database.query, All variable references need to maintain within the Apex Class Query scope. By using Database.queryBind no need to worry about scope of query and variables all this handled by BindsMap.
Map<String, Object> acctBinds = new Map<String, Object>{'acctName' => 'Acme Corporation'};
List<Account> accts = Database.queryWithBinds('SELECT Id FROM Account WHERE Name = :acctName',acctBinds,AccessLevel.USER_MODE);



















Sarkari Yojana refers to government schemes launched by the Central and State Governments of India to promote social and economic welfare
Sarkari Yojana refers to government schemes launched by the Central and State Governments of India to promote social and economic welfare. These schemes aim to support citizens in areas like education, employment, healthcare, housing, agriculture , and financial inclusion. From empowering women and farmers to providing affordable housing and skill development, Sarkari Yojanas play a crucial role in nation-building and improving the quality of life for every Indian.
Sarkari Yojana refers to government schemes launched by the Central and State Governments of India to promote social and economic welfare. These schemes aim to support citizens in areas like education, employment, healthcare, housing, agriculture, and financial inclusion. From empowering women and farmers to providing affordable housing and skill development, Sarkari Yojanas play a crucial role in nation-building and improving the quality of life for every Indian.
ero me is a growing hub for creators to share and explore unique content. Find out how to join, navigate, and maximize your Erome experience.
Erome is a growing hub for creators to share and explore unique content. Find out how to join, navigate, and maximize your Erome experience.