Posts

Showing posts from December, 2023

Bind Variables in a SOQL Query - getContactIDWithBinds

  public class QueryContact {     public static Id getContactID(String lastName, String title) {         try {             Contact myContact = [SELECT Id FROM Contact WHERE LastName = :lastName AND Title = :title LIMIT 1];             return myContact.Id;         } catch (Exception ex) {             return null;         }     }     public static Id getContactIDWithBinds(Map<String, Object> bindVars) {         // do not modify any code above this line         // implement the logic that will use bindVars to retrieve the contact's ID         String queryString = 'SELECT Id FROM Contact WHERE LastName = :lastName AND Title = :title LIMIT 1';         try {             // Ensure that the bind var...