Salesforce Interview Questions with Answers Part 35

1. When will you use Process builder or Workflow?

2. When a new opportunity is created I need to update the status as Processing, what will you use? Process Builder or Workflow? Why?

Workflow Field Update is preferable because if field update is done using Process builder, then record will go through complete Save cycle again.
If field update is done using Workflow field update, then Custom validation rules, duplicate rules, and escalation rules will not run again.

3. You have a customer sitting in front of you and giving his requirements. You go into your org to check something. How do you identify if you are in FORCE.COM or ?

Setup keyword in the URL says that we are in

4. How can we avoid View State memory error?

5. what is transient ? is it class level or Object level?

Class level.

6. Can we use SOSL within triggers? Can we use SOSL within APEX classes?

We can't use SOSL in Triggers Because the apex developer's guide says SOSL statements evaluate to a list of lists of sObjects, where each list contains the search results for a particular sObject type. The result lists are always returned in the same order as they were specified in the SOSL query. SOSL queries are only supported in Apex classes and anonymous blocks.You cannot use a SOSL query in a trigger.

7. What is External ID? How it is used? Can it have duplicates?

It can contain duplicates. But if unique check box is checked, then it cannot contain duplicates.

8. How is deployment process carried out in FORCE.COM IDE?

Backup from target is archived and then deployed to target.

9. What are the WSDLs that Salesforce offers?

Enterprise WSDL
Partner WSDL
Metadata WSDL
Tooling WSDL
Delegated Authentication WSDL

10. What is stateless and state full?

Stateless and State full determines whether to maintain variable value inside the Batch class.

11. If you want an secure interface which one will you use? SOAP or REST?


12. Can we update a record in Before Insert using Trigger.New?

No using DML operation since Id won't be available. Yes without using DML operation for pre-populating field values.

13. Is Static at class level? 


14. What is the maximum number of records returned by SOQL ? 

It depends upon the context. Inside the Apex controller it is 50,000.

15. What are the types of SOQL statements in Salesforce?

1.Static SOQL: The static SOQL Statement is written in [] (Array Brackets)

List < String > listTypes = new List < String > {'Customer', 'Partner'};
List < Account > listAcct = [ SELECT Id, Name FROM Account WHERE Type =: listTypes ];

2. Dynamic SOQL: It is used to refer to the creation of a SOQL string at runtime with Apex code.

List < String > listTypes = new List < String > {'Customer', 'Partner'};
List < Account > listAcct = Database.query('SELECT Id, Name FROM Account WHERE Type =: listTypes');

What is the difference between Process builder and Workflow?

Process Builder:
You can use the Process Builder to perform more actions than with workflow:

1. Create a record
2. Update any related record
3. Use a quick action to create a record, update a record, or log a call
4. Launch a flow
5. Send an email
6. Post to Chatter
7. Submit for approval
8. Call apex methods
9. But the process builder doesn’t support outbound messages.

a. Create a Record, Quick Action uses one DML count.
b. Process can evaluate the same record up to six times in a single save operation.

Workflow does only 4 actions

1. Create Task
2. Field Update
3. Email Alert
4. Outbound Message

a. No DML Limit calculated.
b. May cause your organization to exceed its limit for workflow time triggers per hour.

How to have different Community Builder page content based on profile?

1. Go to the page in Community Builder and select Page Variations tab. Click "New Page Variation" button.

2. Select your page option.

3. Give any name and click "Create" button.

4. Edit the page variation.

5. Do the required changes.

6. Select Manage Visibility.

7. Select the profile to view this change.


Debug Log for Salesforce Community Self Register Page


System.SObjectException: Field is not writeable: User.ProfileId

If you are trying to create users using apex and if you face "System.SObjectException: Field is not writeable: User.ProfileId" issue, remove with sharing keyword from the class.

The reason behind this is external users or guest users and so on will not have access to ProfileId field in user object.


How to get value from text box in Salesforce Lightning Component?

Sample Code:

Lightning Component:

<aura:component implements="forceCommunity:availableForAllPageTypes">

    <aura:attribute name="firstname"/>

    <ui:inputText label="First Name" value="{!v.firstname}"/>
    <ui:button label="Register" press="{!c.registerUser}"/>


Lightning Component Controller:

registerUser : function(component, event, helper) {

External Sharing Related List Not Available

1. Go to Salesforce to Salesforce Settings.

2. Enable Salesforce to Salesforce.


Values to be defined while creating New Opportunity Stage Value

Values to be defined while creating New Opportunity Stage Value are

1. Type
2. Probability
3. Forecast Category
4. Sales Processes.


Process Builder deployment using Change Set

Select Component Type as Flow Definition to deploy Process Builder using Changeset.


How to create page in Salesforce Community Builder for Community Register confirm?

1. Create a Custom Page under Login Pages in Salesforce Community Builder. Copy the URL.

2. Paste the URL as mentioned below. Once the user completes the Community Registration, he/she will be redirected to the Custom Page.


How to get Object Name from Id value in Salesforce?

Sample Code:

Visualforce page:

  1. <apex:page Controller="sample" sidebar="false" >  
  2. <apex:form >  
  3.     <apex:pageblock id="pg" >  
  4.         <apex:pageblockSection >  
  5.             <apex:pageBlockSectionItem >Record Id</apex:pageBlockSectionItem>  
  6.             <apex:pageblockSectionItem ><apex:inputtext value="{!recId}" /></apex:pageblockSectionItem>  
  7.         </apex:pageblockSection>  
  8.         <apex:pageBlockButtons >  
  9.             <apex:commandButton value="Find" action="{!find}" reRender="pg"/>  
  10.         </apex:pageBlockButtons>  
  11.         <apex:outputText >The object type is : {!objType}</apex:outputText>  
  12.     </apex:pageblock>  
  13. </apex:form>     
  14. </apex:page>  

Apex: Controller:

  1. public with sharing class sample {  
  4.     public Id recId {get;set;}  
  5.     public Schema.SObjectType objType {get;set;}  
  7.     public void find() {  
  10.         objType = recId.getSobjectType();  
  11.         System.debug('Object Type is ' + objType);  
  14.     }  
  17. }  


Select Post Destination in Napili Template Salesforce Community is empty

1. Go to Community Management.

2. Select Navigational Topics.

2. Give any Topic Name, click Add and Save.

Saved Navigational Topics:



What is the difference between Action function and remote function?

Action Function:

1. We cannot return value to the Visualforce page i.e callback.
2. We can call the apex methods only from the class linked to the Visualforce page.
3. Action function cannot submit the form.

Remote Function:

1. We can return value to the Visualforce page i.e callback.
2. We can call the apex methods from any apex class.
3. Remote function can submit the form.

How to enable Work Order in Salesforce?

1. Go to Work Order Settings.

2. Enable Work Orders.

3. Add Work Order related list to Account.

4. Create a new Work Order record from Account by clicking "New Work Order" button.

5. Save the record.


Field Service Lightning in Salesforce

Deliver faster, smarter, more personalized service from the phone to the field on one platform with Field Service Lightning.

From the call center to the field, Field Service Lightning is the best way to ensure that you can deliver world-class customer service during on-site interactions. In addition to other functions, you can:
  1. Create work orders;
  2. Dispatch the right field technician for the job;
  3. Monitor performance in the field; and
  4. Give technicians a 360-degree view of the customer.
Delivering faster, smarter, more personalized service in the field means that your field technicians can keep up with rising customer expectations for customer care at every interaction.

Field Service Lightning includes a bevy of features that serve field service dispatchers, admins, and technicians on the go:
  1. A dynamic scheduling board that gives dispatchers and supervisors a bird’s-eye view of all scheduled service appointments
  2. Smart scheduling capabilities that account for technician skill level, travel time, location, and other service factors
  3. A selection of out-of-the-box triggers that allow for easy customization of your scheduling and display preferences
  4. A robust toolbox of custom objects, work rules, and scheduling policies that you can use to define your ideal scheduling model
Chatter Group:


You can enable in a Developer Edition org and play with it.

Trailhead Module -

Salesforce My Domain Pros and Cons

Can I rename or remove my custom domain name?
We can’t change our custom domain name, or reverse its deployment, once deployed. If we have a special need to change it, we have to contact Salesforce Customer Support.

After we deploy our domain, it's activated immediately and requests with the original URL are redirected to our new domain. Only Salesforce Customer Support can disable or change our domain name after it's deployed.

My Domain is required before we can use these Salesforce features:
1. Single sign-on (SSO) with external identity providers

2. Social sign-on with authentication providers, such as Google and Facebook

3. Lightning components in Lightning component tabs, Lightning Pages, the Lightning App Builder, or standalone apps

Can we have multiple domains?
We can have multiple domains and custom URLs only for Site, and Communities but not for logging into Salesforce.

Currently only one My Domain is allowed per organization. Multiple custom domains are possible by CNAME'ing a Site to each specific custom domain.

Can we have alias for domains?
Alias are possible by CNAME'ing a Site to each specific custom domain. It is not supported for Salesforce login.


SOQL to fetch Marketing User field from User object Salesforce

Use the below SOQL to fetch Marketing User field from User object Salesforce.


SELECT Id, UserPermissionsMarketingUser FROM User

Created Date in Case for Formula Field in Salesforce


Read only after checking into TFS IDE Salesforce

Before updating the local project, do the below


Validation Rule to support 10 digit number or Email Address Salesforce

Check the below formula for Validation Rule to support 10 digit number or Email Address

Validation Rule:

NOT ( 
OR ( REGEX( InfallibleTech__Employee_Name__c , '[0-9]{10}'), 
REGEX ( InfallibleTech__Employee_Name__c , '[a-zA-Z0-9._-]+@[a-zA-Z]+.[a-zA-Z]{2,4}') 
) )

Kindly replace your field name.


How to avoid double clicking of apex:commandButton?

Below sample code helps to avoid double clicking of apex:commandButton.

Sample Code:

<apex:pageBlockButtons location="bottom">
<apex:actionStatus id="saveStatus">
<apex:facet name="stop">
<apex:commandButton value="Next Step" action="{!newCase}" status="saveStatus" reRender="thefrm"/>
<apex:facet name="start">
<apex:commandButton value="Saving" disabled="true"/>


How to disable apex:commandButton and enable after the action?

Below sample code helps to disable apex:commandButton and enable after the action.

Sample Code:

<apex:commandButton value="Next Step" action="{!newCase}" onclick="this.disabled=true;this.value='Saving';this.form.submit();" oncomplete="this.disabled=false;this.value='Next Step';" />

Cheers!!! IDE installation for Neon Eclipse

1. Download the Neon Eclipse package using the below link

2. Go to Help --> Instal New Software.

3. Click "Add".

4. Enter the information as below.

5. Click "Next".

6. Accept the Agreement.

7. Click Finish.

8. Restart your Eclipse.


Salesforce Summer '16 Release Short Summary

Create Multiple Calendars from Anything in Lightning Experience
Help us to create multiple calendars as we have in iPhone and other Calendar Apps.

Field Service Lightning

Super Support Team Metrics—Active Time Tracker
Many service organizations live by metrics and fine-tune their team’s service capabilities based on measurement-driven decisions.

Email Studio
Email Studio is a powerful and intuitive tool that helps you quickly customize, target, and send important emails. Create personalized and beautiful content using the integrated Content Builder.

Content Builder
Content Builder is a content management system for creating and managing marketing assets. It’s integrated into Email Studio, so you can add content directly to your emails. It’s also perfect for managing the images, text, and templates that customers love.

Marketing Cloud Mobile App
Marketing Cloud Mobile App for iOS makes everyone all-star marketer right from phone or tablet.

Moderation Controls in Communities

Profile-Based Page Visibility

Experience Supercharged Global Search
Global search has landed in your community. And it’s time to board the smooth flight to the land of searching across all objects connected to the community—all in one place.

Collaboration on Wave
Wave Analytics makes it easy for you to see and act on your business data. Wave’s mobile-first design also lets your team slice and dice data, no matter where they’re working. With Summer ’16, Wave includes new collaboration features, bringing more data-driven dialogue for your team. More data-driven dialogue means better business decisions. Wave Collaboration is going to drive so many data-driven conversations in your company that you might need to buy ear plugs or ask your team to quiet down a bit.

Wave of App Packaging
Allow us to create and sell Wave App in AppExchange.

Wave Thematic Maps
Help us to see reports based on region.

Lightning Security Health Check
Lightning Security Heath Check help you to quickly identify and address security gaps.

Lightning Inspector
Visual debugging tool for Lightning components. Available in Chrome Plugin.


How to update parent records when task is created or updated?

Sample Trigger:

trigger TaskTrigger on Task (after insert, after update) {
    Set < Id > setOpptyIds = new Set < Id >();
    for ( Task t : trigger.New) {
        if ( t.WhatId.getSobjectType().getDescribe().Name == 'Opportunity' )
    if ( setOpptyIds.size() > 0 ) {
        List < Opportunity > listOppty = new List < Opportunity >();
        for ( Id opptyId : setOpptyIds ) {
            listOppty.add(new Opportunity(Id = opptyId));
        update listOppty;


OpenID Connect Protocol

Like SAML, OpenID Connect is a protocol based on OAuth 2.0 that sends identity information from one service to another. Unlike SAML, OpenID Connect is built for today’s world of social networks.

Have you ever installed a new app and come across a prompt like "Log in with your Google account"? That app is using the OpenID Connect protocol.

When you sign in with Google, you’re not creating an account and another password. Only Google holds that information.


Service Providers and Identity Providers

In the process of authenticating users, SAML exchanges identity information between the holder of the information, called an identity provider (IdP), and the desired service, called a service provider.

In the case where a user logs in to Salesforce and then accesses Gmail, Salesforce is the identity provider, and Google is the service provider. Salesforce can be both a service provider and identity provider.


What Features Does Salesforce Identity Provide?

Salesforce Identity connects your Salesforce org users with external apps and services while providing administrative tools for monitoring, maintaining, and reporting user apps and user authorization.
  1. Single sign-on
  2. Connected apps
  3. Social sign-on
  4. Two-factor authentication
  5. My Domain
  6. Centralized user account management
  7. User provisioning
  8. Identity Connect
  9. App Launcher

Salesforce Identity connect -

How to print Visualforce page without header and footer int eh Print preview?

Sample Code:

Visualforce page:

<apex:page controller="Sample" showHeader="false">
<style type="text/css">

        size: auto A4 landscape;
        margin: 3mm;

<apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!listAcct}" var="a">
            <apex:column value="{!a.Id}"/>
            <apex:column value="{!a.Name}"/>
        <apex:pageBlockButtons >
            <apex:commandButton value="Print" onclick="window.print()"/>

Apex Class:

public class Sample {
    public List < Account > listAcct {get;set;}
    public Sample() {
        listAcct = [ SELECT Id, Name FROM Account ];


How to get Case details from CaseComment object in trigger?

Sample Code:

Set < Id > caseCommIds = new Set < Id >();
        Decimal TotalTime = 0;
    for ( CaseComment cas : ) {
    List < CaseComment > listCaseComments = [ SELECT Id, Parent.CaseNumber, Parent.Description FROM CaseComment WHERE Id IN: caseCommIds ];
        for ( CaseComment cas : listCaseComments ) {