top of page

Use static query instead of dynamic query

Eg of dynmic query:

String query = 'select id from account where name = \'' + name + '\'';

List<Account> queryResult = Database.query(query);


Best practice is to use static query and bind variable:

List<Account> queryResult = [select id from account where name = :name];

Recent Posts

See All
To prevent SOQL injection

Use the following: SOQL injection - a SOQL injection attack can be used by attackers to access otherwise restricted data in your...

 
 
 

Comments


Post: Blog2_Post

©2020 by SalesforceDemystified. Proudly created with Wix.com

bottom of page