Comparing Leads with Accounts in Salesforce

1. Create a Account Matching Rule.

2. Create a Duplicate Rule using the account matching rule for Lead.

How/Where to find a list of PushTopics created in Salesforce?

Sample SOQL:

SELECT Id, Name, CreatedDate, CreatedBy.Name FROM PushTopic

Chatter email notifications not received by users that were mentioned in Salesforce

1. Check the email of the user. Sometimes, the user's email in sandbox after refresh will have incorrect email with "@example".

2. Check Email Deliverability.

3. Check this too -

DKIM Keys in Salesforce

Salesforce uses DKIM keys to sign outbound emails that your organization sends from the Salesforce platform.

Use the DKIM (DomainKeys Identified Mail) key feature to let Salesforce sign outbound email sent on your company’s behalf. These signatures give recipients confidence that the email was handled in a way that’s consistent with your company.

To ensure your email message from Salesforce do not end up unread in the recipient’s spam folder,you can  easily implement DomainKeys Identified Mail (DKIM).Use the DKIM (DomainKeys Identified Mail) key feature to enable Salesforce to sign outbound emails sent on your organization’s behalf. A valid signature provides recipients confidence that the email was handled by a third party such as Salesforce in a way authorized by your organization.

Make sure you add the public key to your DNS record before you make your key active in Salesforce and start DKIM signing. DKIM signing is active whenever your DKIM key is in the active state.

To Create DKIK Keys, go to

What is a query locator in Salesforce?

A query locator represents a server-side cursor for a query. Typically a query locator is returned when not all the records requested in a query fit into the returned data set. This way a queryMore() can be issued with the provided query locator to get additional rows.

For example, consider a query API call where the batch size is set to 2,000 and the organization has 2000+ accounts. In this scenario, SELECT id FROM account will return 2,000 records and a query locator to retrieve the remaining records.

How to set Page Variation using Account information in Salesforce Community Cloud?

1. Create Audience based on Account information.

2. Create page Variation and assign the audience.

How to get DateTime in User Time Zone using Apex in Salesforce?

DateTime field values are stored as Coordinated Universal Time (UTC). When a dateTime value is returned in Salesforce, it’s adjusted for the time zone specified in your org preferences. SOQL queries, however, return dateTime field values as UTC values. If you want to process these values in different time zones, your application might need to handle the conversion.

Sample Code:

  1. Account acc = [ SELECT Id, CreatedDate FROM Account WHERE Id = '0015A000025NLtRQAW' ];  
  2. system.debug('Created Date is ' + acc.CreatedDate);  
  3. system.debug('Created Date is ' + acc.CreatedDate.format('YYYY-MM-dd hh:mm:ss'));  


How to Switch Between Your Salesforce Org and Communities in Lightning Experience?

In Lightning Experience, the App Launcher displays a tile for every published community along with your apps.

1. Click App Launcher.

2. Select the Community from the App Launcher.

LAST_N_DAYS in Salesforce

For the number n provided, starts 00:00:00 of the current day and continues for the past n days.

It includes today also.

Sample SOQL:

SELECT Id FROM Account WHERE CreatedDate = LAST_N_DAYS:365

Example -

Einstein Activity Capture in Salesforce

Einstein Activity Capture adds every email & event to Salesforce.

Einstein Activity Capture connects to Gmail or Office 365, automatically syncing all of your team’s customer communications to Salesforce. When reps send and receive emails and calendar events, Einstein ActivityCapture adds the messages to appropriate records in Salesforce – no manual data entry required. All of the captured messages are visible in Activity Timeline withinSalesforce, providing context for your entire team so they can help close the deal.

Check for more information.

To exclude users, check

Lightning Notifications using Apex

Sample Code:

  1. FeedItem post = new FeedItem();  
  3. post.Body = 'Enter post text here';  
  5. post.ParentId = '005U0000000gviFIAQ';//Id of the user record  
  9. insert post;  


How to Relate a File to multiple records in Salesforce?

Sample Code:

  1. ContentDocumentLink objCDL = new ContentDocumentLink();  
  2. objCDL.ContentDocumentId = '0695A000004dRpRQAU';//Id of the file  
  3. objCDL.LinkedEntityId = '0035A00003MuvnuQAB';//Id of the record for sharing  
  4. objCDL.ShareType = 'V';  
  5. insert objCDL;  

All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes Salesforce

When you face "All records that meet the filter criteria are ready to be updated when the next Screen or Wait element is executed or when the interview finishes", set up debug log to find the root cause of the issue.

If you look at the above debug log, it says Apex CPU Time limit exceeded.

List View Search in Salesforce

Use the new search bar to search the field data in your list views and find the records you need in record time.

Picklist values, lookup fields, derived fields, or formula fields are not searchable.

To find the fields that are searchable, check the below link

FIELD_INTEGRITY_EXCEPTION: An event can't last longer than 14 days Salesforce exception

FIELD_INTEGRITY_EXCEPTION: An event can't last longer than 14 days exception occurs when the difference between Start Date/Time and End Date/Time is greater than 14 days.

Sample Code:

  1. Event objEvent = new Event(Subject = 'Test', StartDateTime =, EndDateTime =;  
  3. insert objEvent;  

How to Set Two-Factor Authentication Login Requirements in Salesforce?

1. Download Salesforce Authenticator App in your phone.

2. In the profile or permission set, set Session Security Level Required at Login to High Assurance.

3. In the Session Settings, add Two Factor Authentication.

4. Try to login.

5. It will show the screen to enter the words from Salesforce Authenticator app.

6. Click Add Account in Salesforce Authenticator app to get the words.

7. Click Connect button to connect.

How to find how many dynamic dashboards are created in Salesforce?

Sample SOQL:

SELECT Id, DeveloperName, FolderName, CreatedBy.Name, LastModifiedBy.Name FROM Dashboard WHERE Type = 'LoggedInUser'


( OR )

1. Create a Custom Report Type using the Dashboards type.

2. Create a new report with the new Dashboards Report Type.

3. Select Show All Dashboards.

4. Select the All Time range.

5. Add the following filter: Dashboard Running User equals "Run as logged-in user, Let authorized users change running user".

Work Order Entitlement Processes in Salesforce

1. Go to the Entitlement Settings.

2. Check Enable Entitlement Management.

3. Create a Milestone in Salesforce.

4. Go to Entitlement Processes.

5. Click New Entitlement Processes.

5. Select Work Order as Entitlement Processes type.

6. Create a simple Entitlement Process with Milestone.

7. Define actions in Milestone.

8. Add Entitlement related fields and related list to the Work Order page layout.

9. Go to the Entitlements tab and create the Entitlement record.

10. Create a Work Order to see the Entitlement.

Locked Tab from Managed Package in Lightning Experience

If the Lightning app was installed from a managed package, you can append navigation items below the original set of navigation items included in the Lightning app, which are locked.

The locked icon (1) indicates that this set of tabs is fixed and can’t be changed.

Release Notes -

Simple Batch Job Status email in batch's finish method in Salesforce

Sample Code:

  1. global class SampleBatch Implements Database.Batchable <sObject> {  
  3.     global Database.queryLocator start( Database.BatchableContext bc ) {  
  5.         String SOQL = 'SELECT Id, Name FROM Account LIMIT 1';  
  6.         return Database.getQueryLocator(SOQL);  
  8.     }  
  10.     global void execute( Database.BatchableContext bc, List < sObject > scope ) {  
  12.     }  
  14.     global void finish( Database.BatchableContext bc ) {  
  16.         AsyncApexJob a = [ SELECT Id, Status, NumberOfErrors, JobItemsProcessed, TotalJobItems, CreatedById  
  17.                              FROM AsyncApexJob  
  18.                             WHERE Id =: bc.getJobId() ];  
  19.         Messaging.SingleEmailMessage batchEmail = new Messaging.SingleEmailMessage();  
  20.         batchEmail.setTargetObjectId( a.CreatedById );  
  21.         batchEmail.setSubject( 'Batch ' + a.Status );  
  22.         batchEmail.setPlainTextBody( 'Jobs processed ' + a.JobItemsProcessed + ' with '+ a.NumberOfErrors + ' failures.' );  
  23.         batchEmail.setSaveAsActivity( false );  
  24.         Messaging.sendEmail( new Messaging.SingleEmailMessage[] {batchEmail} );  
  26.     }  
  28. }  


Anchor tag in Visualforce page

Sample code:

  1. <apex:page>  
  3.     Link to Salesforce is below<br/><br/>  
  4.     <apex:outputLink value="" id="theLink"></apex:outputLink>  
  6. </apex:page>  


View all call logs or report in Salesforce

1. Create a report with Tasks & Events.

2. Select Activity Type as Call in the filter.

How to Convert Attachments to Files in Salesforce?

Convert the attachments to files with the new Attachments to Files app from Salesforce Labs.

AppExchange Link -

You can use the Attachments to Files tool to run bulk jobs that convert large numbers of attachments. Attachments are organized by the object they’re associated to. After the conversion, you can delete the attachments from the org to free up space.

Difference between extends and implements keywords

extends is for extending a class. 

implements is for implementing an interface.

extends is for when you're inheriting from a base class (i.e. extending its functionality). 

implements is for when you're implementing an interface.

A class can only "implement" an interface. A class only "extends" a class. Likewise, an interface can extend another interface. A class can only extend one other class. A class can implement several interfaces.

lightning:map - Showing multiple markers in Map in Salesforce Lightning Component?

Sample Code:

Lightning Component:

  1. <aura:component implements="force:appHostable" controller="AccountListController" >  
  3.     <aura:attribute name="markers" type="Object[]"/>  
  4.     <aura:attribute type="Account[]" name="acctList"/>  
  5.     <aura:attribute name="mycolumns" type="List"/>  
  7.     <aura:handler name="init" value="{! this }" action="{! c.fetchAddr }"/>  
  9.     <div class="slds-grid slds-grid_vertical">  
  11.         <div class="slds-col">  
  13.             <lightning:datatable data="{! v.acctList }"   
  14.                                  columns="{! v.mycolumns }"   
  15.                                  keyField="id"  
  16.                                  hideCheckboxColumn="true"/>  
  18.         </div>  
  20.         <div class="slds-col">  
  22.             <lightning:map mapMarkers="{! v.markers }"/>  
  24.         </div>  
  26.     </div>  
  28. </aura:component>  

Lightning Component Controller:

  1. ({  
  3.     fetchAddr : function(component, event, helper) {  
  5.         component.set('v.mycolumns', [  
  6.             {label: 'Account Name', fieldName: 'Name', type: 'text'},  
  7.             {label: 'Billing State', fieldName: 'BillingState', type: 'text'},  
  8.             {label: 'Billing City', fieldName: 'BillingCity', type: 'Text'}  
  9.         ]);  
  11.         var action = component.get("c.fetchAddresses");  
  12.         action.setCallback(this, function(response) {  
  14.             var state = response.getState();  
  15.             if ( state === "SUCCESS" ) {  
  17.                 component.set( "v.acctList", response.getReturnValue().listAcct );  
  18.                 component.set( "v.markers", response.getReturnValue().listAddrWrap );  
  20.             }  
  22.         });  
  23.         $A.enqueueAction( action );  
  25.     }  
  27. })  

Apex Class:

  1. public class AccountListController {  
  3.     @AuraEnabled  
  4.     public static Wrapper fetchAddresses() {  
  6.         List < CompleteAddressWrapper > listAddrWrap = new List < CompleteAddressWrapper >();  
  7.         List < Account > listAcct = new List < Account >();  
  8.         Wrapper wrap = new Wrapper();  
  10.         for ( Account acc: [ SELECT Id, Name, BillingStreet, BillingState, BillingCountry, BillingPostalCode,  
  11.                                     BillingCity, BillingLatitude, BillingLongitude  
  12.                                FROM Account   
  13.                               WHERE BillingStreet != null   
  14.                               LIMIT 100 ] ) {  
  16.             AddressWrapper addrWrap = new AddressWrapper();       
  17.             CompleteAddressWrapper objWrap = new CompleteAddressWrapper();  
  18.             addrWrap.Street = acc.BillingStreet;  
  19.             addrWrap.City = acc.BillingCity;  
  20.             addrWrap.State = acc.BillingState;  
  21.             addrWrap.Country = acc.BillingCountry;  
  22.             addrWrap.PostalCode = acc.BillingPostalCode;  
  23.             objWrap.location = addrWrap;  
  24.             objWrap.icon = 'custom:custom32';  
  25.             objWrap.title = acc.Name;  
  26.             listAddrWrap.add(objWrap);  
  27.             listAcct.add(acc);  
  29.         }   
  31.         wrap.listAcct = listAcct;  
  32.         wrap.listAddrWrap = listAddrWrap;  
  33.         system.debug('Out ' + listAddrWrap);  
  34.         return wrap;  
  36.     }  
  38.     public class Wrapper {  
  40.         @AuraEnabled  
  41.         public List < Account > listAcct;  
  42.         @AuraEnabled  
  43.         public List < CompleteAddressWrapper > listAddrWrap;  
  45.     }  
  47.     public class AddressWrapper {  
  49.         @AuraEnabled   
  50.         public String Street;  
  51.         @AuraEnabled   
  52.         public String City;  
  53.         @AuraEnabled   
  54.         public String State;  
  55.         @AuraEnabled   
  56.         public String Country;  
  57.         @AuraEnabled   
  58.         public String PostalCode;  
  60.     }  
  62.     public class CompleteAddressWrapper {  
  64.         @AuraEnabled   
  65.         public String title;  
  66.         @AuraEnabled   
  67.         public String icon;  
  68.         @AuraEnabled   
  69.         public AddressWrapper location;  
  71.     }  
  73. }