Skip to content

Instantly share code, notes, and snippets.

@suddeb
Created October 3, 2016 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suddeb/7bf214234e7f2bf467cfb9f83b039845 to your computer and use it in GitHub Desktop.
Save suddeb/7bf214234e7f2bf467cfb9f83b039845 to your computer and use it in GitHub Desktop.
CorrectDynamicSOQL
MyCustomObject__c newCustomObject = new MyCustomObject__c(myCustomField__c ='My Custome Field');
String fieldValue = newCustomObject.myCustomField__c;
List<sObject> sObjList = Database.query('SELECT Id FROM MyCustomObject__c WHERE myCustomField__c = :fieldValue');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment