Given a list of Opportunity records named opportunityList, which code snippet is best for querying all Contacts of the Opportunity’s Account?

code Snippet #1 is the correct answer as you won’t end up pulling duplicate contacts into the contact list


Code Snippet #1:


Code Snippet #2 : Issue: Coding Error : List defined incorrectly


Code Snippet #3 :


Code Snippet #4 : Issue: Coding error : you can’t read a list directly from OpportunityList


Test.startTest and Test.stopTest for asynchronous execution

You can also use this method with stopTest to ensure that all asynchronous calls that come after the startTest method are run before doing any assertions or testing. Each test method is allowed to call this method only once. All of the code before this method should be used to initialize variables, populate data structures, and so on, allowing you to set up everything you need to run your test. Any code that executes after the call to startTest and before stopTest is assigned a new set of governor limits.




Invoking a Queueable class from LWC

Execute a Queueable class when Salesforce community user access Lightning URL


<lightning-card title=”Execute GenerateQuoteQueueable” icon-name=”custom:custom63″>

<p class=”slds-m-bottom_small”>

<lightning-button label=”Execute Queue” onclick={handleLoad}></lightning-button>

<div class=”slds-m-around_medium”>

<template if:true={responseReceived}> {jobId} </template>

</div> </lightning-card></template>

Practice simplifying object- and field-level security checks with new Spring ’19 in Apex code

updated challenge code

How to identify User Theme?

Use these variables to identify the CSS used to render Salesforce web pages to a user. Both variables return one of the following values.

  • Theme1—Obsolete Salesforce theme
  • Theme2—Salesforce Classic 2005 user interface theme
  • Theme3—Salesforce Classic 2010 user interface theme
  • Theme4d—Modern “Lightning Experience” Salesforce theme
  • Theme4t—Salesforce mobile app theme
  • Theme4u—Lightning Console theme
  • PortalDefault—Salesforce Customer Portal theme
  • Webstore—Salesforce AppExchange theme

Did you know?

2. The inner class will be the only thing that runs outside of sharing context, everything else will still be in sharing context.

APEX Code Snippets

Reading inline Query data in APEX



This example generates a JSON string in pretty print format by using the methods of the JSONGenerator class