In this blog, I have highlighted some topics which I found important based on my exam and you can expect one or two questions from each. These topics are perfect for revision before your PD II certification.
The topics are segregated as Visualforce, Apex, and Lightning.
About
Platform Developer II program is designed to demonstrate the skills and knowledge in advanced programmatic capabilities of the Lightning Platform and data modeling to develop complex business logic and interfaces.
To earn this credential you need to complete following two steps
Strategy
You can find some tips on strategizing your certification exam from my blog about Certified System Architect.
Important Topics
Following are the topics which should be studied thoroughly and also good for a quick revision.
Visualforce
- Transient Keyword Developer Guide
- Use the transient keyword to declare instance variables that can’t be saved and shouldn’t be transmitted as part of the view state for a Visualforce page.
- Visualforce for Large Data Volumes & Lazy Loading Developer Guide
- Loads specific parts of the page for faster access using custom rendering, Javascript Remoting, and Custom Components.
- Visualforce Controllers
- Standard Controller – Guide
- What all can be done directly with a standard controller and not using any custom controller or extension?
- What are all available actions in a standard controller? Answer.
- Custom Controller & Controller Extension – Guide
- When to go for a custom controller instead of using a controller extension?
- Standard Set Controller – Guide
- Supports 10,000 rows of data.
- Standard Controller – Guide
**CONTROLLER EXTENSION**
public myControllerExtension(ApexPages.StandardController stdController){
this.acct = (Account)stdController.getRecord();
}
**SET CONTROLLER**
setCon = ApexPages.StandardSetController(Database.getQueryLocator(queryString));
setCon.setPageSize(size); --> Sets page Size
setCon.getResultSize(); --> Find total record count
setCon.getRecords(); --> Find the records to be displayed
{!setCon.first}, {!setCon.next}, {!setCon.previous}, {!setCon.last} --> Pagination Methods
- Related List VF Component
- Can be implemented using a standard controller itself.
<apex:detail relatedList =”false”/>
<apex:relatedList list=”Contacts”/>
- JS Remoting & VF Remote Objects – Guide
- JS Remoting – Guide
- Makes basic CRUD object access easy
- Doesn’t require any Apex code
- Supports minimal server-side application logic
- Doesn’t provide automatic relationship traversals; you must look up related objects yourself
- VF Remote Object – Guide
- Requires both JavaScript and Apex code
- Supports complex server-side application logic
- Handles complex object relationships better
- Uses network connections (even) more efficiently
- JS Remoting – Guide
- VF Page Testing
setCurrentPage()
– StackExchange
**Page reference is passed as a parameter**
Pagereference pref = page.AccountPage;
Test.setCurrentPage(pref);
- Continuation VF page – Guide
- Action methods return a continuation object
public Object calloutActionMethodName()
- Callback Methods
public static Object callbackMethodName(List< String> labels, Object state)
- Returns null, page reference, or another continuation for chaining more continuations.
- You can chain up to three callouts.
- In test classes add a mock response
Test.setContinuationResponse(controller.requestLabel, response);
- Action methods return a continuation object
- Visualforce Pagination ( > 10,000 records ) – Developer Blog
- What will be the optimal approach for pagination based on data volume and customizations requirement?
- List Controller – Guide
- StandardSetController – Guide
- JavaScript Remoting – Guide
- Using Offset Query – StackExchange
- Lazy Loading – Guide
- ActionSupport – ActionFunction – ActionRegion
- Action Function – JS function in VF page to call controller method. (Must be inside apex:form)
- Action Support – Add JS event or AJAX support to a component and then call the controller method.
- Action Region – Optimize VF page performance during an AJAX request.
Apex
- DML and Callouts (Limits and Limitations) – Guide
- To perform Callouts from trigger context use
@future
block. - Callouts cannot be done after DML statements, reverse is possible.
- For testing implement
Test.setMock(mock callout class)
and execute in betweenTest.startTest()
andTest.stopTest()
- 100 callouts are allowed in a single transaction
- 120 seconds is the maximum cumulative time allowed for callouts in a single transaction.
- To perform Callouts from trigger context use
- Query optimization for LDV and Selective SOQL Query – Improve Performance – Help Article
- Use Skinny Table – Apex Hours Session
- Indexed Table – Apex Hours Session
- Standard Index (up to 1 M, 30% of 1 M and 15% of additional each million records)
- Custom Index (up to 333K, 10% of each 500K records)
- Query Plan Tool – Help Article
- A tool within the developer console to determine the performance of your SOQL query
- Make SOQL Selective – Help Article
- Indexing will not work if
- Not Equal To, Not Contains, Not Starts with used
- Comparing with NULLS
- Contains operator used and number of rows scanned is > 333K
- Exceeds any of the upper limits defined for indexing.
- Following can’t be Indexed
- Multi-select picklist, Currency (multi-currency org), Long text, binary fields.
- Formula of the following type
- Non-Deterministic – Uses NOW or TODAY and value changes based on time.
- Lookup to multiple objects
- Includes any non-supported index fields
- Includes Text(picklist field)
- Indexing will not work if
- Concurrent usage (Governor limits) – Trailhead
- Max 25 long-running API Requests (time > 20 seconds).
- Callouts cause concurrency between systems
- Reduce the following:
- Number of Apex Triggers
- The complexity of your Query
- Switch to Async process
- Data you are processing in one transaction.
- Solutions
- Async Callouts (Continuation)
- Selective Query
- Bulkify and reduce no of Apex triggers.
- SOQL with Big Object – Guide
- The !=, LIKE, NOT IN, EXCLUDES, and INCLUDES operators are not valid in any query.
- Aggregate functions are not valid in any query.
- Only the last field in a query can use the following operators (=, <, >, <=, >=, and IN)
- SOQL Functions – Guide
- Localized Results SELECT statements can include the Translating Results,
ConvertCurrency()
, andFORMAT()
functions in support of localized fields. - Use
toLabel(fields)
to translate SOQL query results into the user’s language. - Use
SCOPE
clause of a SOQL query to return records within a specified scope.- delegated, everything, mine, mine_and_my_groups, my_territory, my_team_territory…
- KnowledgeArticleVersion SOQL Clause –
UPDATE TRACKING
,UPDATE VIEWSTAT
- HAVING – use a
HAVING
clause with aGROUP BY
clause to filter the results returned by aggregate functions, such asSUM()
. - TYPEOF – A
TYPEOF
expression specifies a set of fields to select that depends on the runtime type of the polymorphic reference. - You can update objects with information about when they were last viewed by using the
FOR VIEW
clause in a SOQL query. - FOR REFERENCE – The
LastReferencedDate
field is updated for any retrieved records. - Use
FOR UPDATE
to lock sObject records while they’re being updated in order to prevent race conditions and other thread safety problems. - Security with
SECURITY_ENFORCED
clause.
- Localized Results SELECT statements can include the Translating Results,
- Platform Events and Streaming API – Guide
- Streaming API uses the Bayeux protocol and CometD, so the client-to-server connection is maintained through long polling.
- Publishing Platform Events
- Process Builder using the Create a Record action
- Flow using a Create Records element
- Apex
EventBus.publish()
method - REST API sObjects resource
- SOAP API
create()
call
- Subscribing to Platform Events
- Process Builder using a process that starts when a platform event occurs
- A flow that waits for a platform event to occur
- Apex trigger
- Streaming API using the CometD messaging library
- The empApi Lightning component
- Static Resources – Help Article
- Package a collection of related files into a directory hierarchy and upload that hierarchy as a .zip or .jar archive.
- Reference a static resource in page markup by name using the $Resource global variable.
- Use relative paths in files in static resource archives to refer to other content within the archive.
- For example, in your CSS file, named styles.css, you have the following style:
table { background-image: url('img/testimage.gif') }
- create an archive (such as a zip file) that includes styles.css and img/testimage.gif
<apex:stylesheet value="{!URLFOR($Resource.style_resources, 'styles.css')}"/>
- For example, in your CSS file, named styles.css, you have the following style:
- A single static resource can be up to 5 MB in size.
- An organization can have up to 250 MB of static resources.
- Static resources apply to your organization’s quota of data storage.
- Load test data from Static Resource
- Account records and a static resource name of
myResource
, make the following call:List<sObject> ls = Test.loadData(Account.sObjectType, 'myResource');
- Account records and a static resource name of
LWC and Aura
- @AuraEnabled Annotation – Guide
- Apex class static methods to make them accessible as remote controller actions in your Lightning components.
- Apex instance methods and properties to make them serializable when an instance of the class is returned as data from a server-side action.
@AuraEnabled(cacheable=true)
– You can improve runtime performance by caching method results on the client by adding(cacheable=true)
to the annotation [API version 44.0 and above].setStorable()
was used in JS before this feature.@AuraEnabled(continuation=true)
– Use the continuation class in Apex to make a long-running request to an external web service.- Separate by space when used together.
@AuraEnabled(continuation=true cacheable=true)
- Component JS Debugging – Guide
- Enable Debug Mode for Lightning Components – Framework JavaScript code isn’t minified and is easier to read and debug.
- Performance is slowed down drastically and should be used temporarily
- Disable Caching Setting During Development – Session Setting
- Enable secure and persistent browser caching to improve performance
- Salesforce Lightning Inspector Chrome Extension
- Log Messages using
console.log()
in browser’s dev console.
- Enable Debug Mode for Lightning Components – Framework JavaScript code isn’t minified and is easier to read and debug.
<lightning:layout/>
multipleRows attributes – Component LibrarymultipleRows(default=false)
– Determines whether to wrap the child items when they exceed the layout width. If true, the items wrap to the following line.
<lightning:layoutItem/>
Device Size attributes – Component Library- If the viewport is divided into 12 parts, this attribute indicates the relative space.
- Accepts integer from 1 to 12
- Attributes available are:
largeDeviceSize
– DesktopmediumDeviceSize
– TabletsmallDeviceSize
– Mobile
- Salesforce Lightning Inspector (Tabs and Usage) – Guide
- Use of Storage and Actions tabs.
- Events Anti-Patterns – Guide
- Don’t Fire an Event in a Renderer – Firing an event in a renderer can cause an infinite rendering loop.
- Error handling for LWC – Developer Blog
- Events in Aura Components
- Component Event
var compEvent = cmp.getEvent("sampleComponentEvent");
- Application Event
var appEvent = $A.get("e.c:appEvent");
- Component Event
- Aura component in Custom Actions – Guide
- For your Aura component to work as a custom action, you must set a default value for each component attribute marked as required.
Conclusion
Platform Developer II is a certification focused on testing your programming skills and you should do hands on with trailmix and superbadge on Trailhead.
The topics outlined in the blog are from my preparation notes and post-mortem of the examination.
Thank you for reading through and all the best for your certification.
Please share your feedback and I’ll incorporate it in my upcoming blogs.