Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
Salesforce Certified Platform Developer II (PDII) · Salesforce
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
When performing a callout after DML in the same transaction, Salesforce requires that there is no uncommitted work pending. Using an @future method (with callout=true) to perform the callout asynchronously moves the callout into its own transaction, thereby avoiding the "uncommitted work pending" error.
C https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_invoking_future_methods.htm global class FutureMethodRecordProcessing { @future public static void processRecords(List<ID> recordIds) { // Get those records based on the IDs List<Account> accts = [SELECT Name FROM Account WHERE Id IN :recordIds]; // Process records } }
B is definitely incorrect because InvocableMethod can only take a list of primitive data type/sobject type/generic sobject type/variables, in conclusion, the input parameter is always a LIST; C is correct because map.keySet() returns a set of key in this case a set of Id, which is not even sobject. -Methods with the future annotation must be static methods, and can only return a void type. The specified parameters must be primitive data types, arrays of primitive data types, or collections of primitive data types. Methods with the future annotation can’t take sObjects or objects as arguments A literally does nothing here, and D is obviously wrong lmao