top of page

Dynamic SOQL ( queryBinds ) || Salesforce

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);
	


7 Comments


Sarkari Yojana refers to government schemes launched by the Central and State Governments of India   to promote social and economic welfare


Like

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.


Like

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.


Like

John Stannis
John Stannis
Oct 15, 2025

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.


Like

John Stannis
John Stannis
Oct 01, 2025

Erome is a growing hub for creators to share and explore unique content. Find out how to join, navigate, and maximize your Erome experience.


Like
bottom of page