Skip to content

Instantly share code, notes, and snippets.

@lfreeland
Created March 28, 2016 00:57
Show Gist options
  • Save lfreeland/1e38e8af6a1845e1e7b0 to your computer and use it in GitHub Desktop.
Save lfreeland/1e38e8af6a1845e1e7b0 to your computer and use it in GitHub Desktop.
Variable Binding Dynamic SOQL
Set<Id> accountIds = …
/* The accountIds variable is directly embedded in the accountQuery string and binded
against in Database.query
*/
String accountQuery = ‘select id, name from Account where Id in :accountIds’;
List<Account> accts = Database.query(accountQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment