Salesforce Interview Questions with Answers Part 35

1. When will you use Process builder or Workflow?

http://www.infallibletechie.com/2016/07/what-is-difference-between-process.html

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 Salesforce.com ?

Setup keyword in the URL says that we are in Force.com.

4. How can we avoid View State memory error?

http://www.infallibletechie.com/2012/09/view-state-in-salesforce.html

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

http://www.infallibletechie.com/2016/01/what-is-use-of-transient-keyword-in.html

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?

http://www.infallibletechie.com/2014/11/what-is-external-id-in-salesforce.html

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
Apex 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.

http://www.infallibletechie.com/2014/06/how-to-maintain-variable-value-inside.html

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

SOAP

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

No.

13. Is Static at class level? 

Yes.

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

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

Cheers!!!

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.

Workflow:

Workflow does only 4 actions

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

Cheers!!!

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.

Cheers!!!

Debug Log for Salesforce Community Self Register Page


Cheers!!!

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.

Cheers!!!

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

Sample Code:

Lightning Component:

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

Lightning Component Controller:

({
registerUser : function(component, event, helper) {
            alert(component.get("v.firstname"));
}
})

Cheers!!!

External Sharing Related List Not Available

1. Go to Salesforce to Salesforce Settings.


2. Enable Salesforce to Salesforce.


Cheers!!!

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.


Cheers!!!

Process Builder deployment using Change Set

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


Cheers!!!

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.


Cheers!!!

How to get Object Name from Id value in Salesforce?

Sample Code:

Visualforce page:

<apex:page Controller="sample" sidebar="false" >
<apex:form >
    <apex:pageblock id="pg" >
        <apex:pageblockSection >
            <apex:pageBlockSectionItem >Record Id</apex:pageBlockSectionItem>
            <apex:pageblockSectionItem ><apex:inputtext value="{!recId}" /></apex:pageblockSectionItem>
        </apex:pageblockSection>
        <apex:pageBlockButtons >
            <apex:commandButton value="Find" action="{!find}" reRender="pg"/>
        </apex:pageBlockButtons>
        <apex:outputText >The object type is : {!objType}</apex:outputText>
    </apex:pageblock>
</apex:form>  
</apex:page>


Apex: Controller:

public with sharing class sample {
    public Id recId {get;set;}
    public String output {get;set;}
    public Schema.SObjectType objType {get;set;}
   
    public void find() {
        objType = recId.getSobjectType();
        System.debug('Object Type is ' + objType);
    }
}


Output:



Cheers!!!

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:


Output:


Cheers!!!

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.

http://www.infallibletechie.com/2012/10/calling-controller-method-using.html

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.

http://www.infallibletechie.com/2012/11/remoteaction-in-visual-force-page.html

Cheers!!!

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.


Cheers!!!

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:
https://partners.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F9300000004flQ

Reference:
http://resources.docs.salesforce.com/rel1/doc/en-us/static/pdf/field_service_lightning_guide.pdf

Cheers!!!

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 Force.com Site, Site.com 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 Force.com Site to each specific custom domain.

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

Cheers!!!

Read only after checking into TFS Force.com IDE Salesforce

Before updating the local project, do the below


Cheers!!!

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}') 
) )

Note:
Kindly replace your field name.

Cheers!!!

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>
<apex:facet name="start">
<apex:commandButton value="Saving" disabled="true"/>
</apex:facet>
</apex:actionStatus>
</apex:pageBlockButtons>

Cheers!!!

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!!!

Force.com IDE installation for Neon Eclipse

1. Download the Neon Eclipse package using the below link

http://www.eclipse.org/downloads/packages/release/Neon/RC3

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


3. Click "Add".


4. Enter the information as below.


http://media.developerforce.com/force-ide/eclipse42

5. Click "Next".


6. Accept the Agreement.

7. Click Finish.

8. Restart your Eclipse.

Cheers!!!

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.

Cheers!!!

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' )
        setOpptyIds.add(t.WhatId);
    }
    if ( setOpptyIds.size() > 0 ) {
        List < Opportunity > listOppty = new List < Opportunity >();
        for ( Id opptyId : setOpptyIds ) {
            listOppty.add(new Opportunity(Id = opptyId));
        }
        update listOppty;
    }
}

Cheers!!!

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.

Cheers!!!

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.

Cheers!!!

What Features Does Salesforce Identity Provide?


  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

Cheers!!!

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

Sample Code:

Visualforce page:

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

@page{
        size: auto A4 landscape;
        margin: 3mm;
     }

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

Apex Class:

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


Output:


Cheers!!!

How to get Case details from CaseComment object in trigger?

Sample Code:

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

Cheers!!!