Monday, December 25, 2023

Platform Developer I Certification Maintenance (Winter '24)



Platform Developer I Certification Maintenance (Winter '24)




→ Maintain Your Platform Developer I Certification for Winter '24

1. Which SOQL keywords can be used to respect the object permissions of the running user for a query in Apex code?
A. WITH USER_MODE
B. WITH SYSTEM_MODE
C. Insert as user
D. Insert as system

2. Where can an error message be displayed by adding the Custom Error Message element to a flow?
A. In a window on the record page
B. As an inline error on a specific field
C. Either A or B
D. Neither A or B

3. Why are the lwc:if, lwc:elseif, and lwc:else conditional directives more efficient than the legacy if:true and if:else directives?
A. Property getters are accessed only once per instance of the directive.
B. No property getters are accessed.
C. The new directives are not more efficient than the legacy directives.
D. Property getters are accessed multiple times.

4. Which of the following can be used to iterate through lists or sets in a for loop?
A. Iterable string
B. Loop construct
C. Iterable variable
D. Index variable

5. Which Apex feature can be used to customize the behavior of the List.sort() method?
A. CustomSort class
B. Comparator interface
C. CustomSort interface
D. Sets

→ Get Hands-on with Bind Variables in a SOQL Query

Launch the org you’ll use for the hands-on challenge, then do the following prework.
Step: 1
Now, as mentioned in trailhead challenge, we need to create one apex class.

To open the Developer Console from Salesforce Classic:

  1. Click Your Name.
  2. Click Developer Console.

To open the Developer Console from Lightning Experience:

  1. Click the quick access menu (Setup gear icon).
  2. Click Developer Console.
Follow below steps in developer console
~ File > New > Apex Class

Step: 2
As mentioned in trailhead challenge, enter 'Apex Class' name and click 'OK' button.
    Class Name: QueryContact



Step: 3 
Copy below mentioned code and paste in developer console and 'Save' this apex class.
public class QueryContact {
  public static Id getContactID(String lastName, String title) {
    try {
      Contact myContact = Database.query(
        '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) {
	String query = 'SELECT ID FROM Contact WHERE lastName = :lastName AND title = :title LIMIT 1';
    List<Contact> listContacts = Database.queryWithBinds(query,bindVars, AccessLevel.USER_MODE);
      if(listContacts != null && !listContacts.isEmpty()){
          return listContacts[0].Id;
      }else{
    	  return null;      
      }
    }
}

Certification Maintenance Due Date: December 6, 2024

23 comments:

  1. Thank you Nikhil for sharing the code.

    ReplyDelete
  2. Thank you Nikhil for sharing!

    ReplyDelete
  3. Thank you so much Nikhil

    ReplyDelete
  4. ありがとうニキル

    ReplyDelete
  5. Salesforce Help: Dynamically Pass Bind Variables to a SOQL Query:

    https://help.salesforce.com/s/articleView?id=release-notes.rn_apex_bind_var_soql.htm&release=242&type=5

    ReplyDelete
  6. Apex Reference Guide: Database Methods:

    https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_database.htm?&_ga=2.97654175.1633002055.1706889881-1749918853.1706889881#apex_System_Database_methods

    ReplyDelete
  7. Thank you for sharing the code, Nikhil.

    ReplyDelete
  8. Thank you Nikhil for sharing code.

    ReplyDelete
  9. Thanks Nikhil 😊😄

    ReplyDelete