Salesforce Interview questions with answers Part 30

1. Life cycle of  Salesforce ?
http://www.infallibletechie.com/2015/11/life-cycle-of-salesforce.html

2. Can we convert Master Detail converts lookup ? and vice versa and how ?
Yes. By using Change Data Type button.

3. How do u create Many to Many relationship?
http://www.infallibletechie.com/2013/03/how-to-create-many-to-many-relationship.html

4. What happens if a junction object is deleted?
Many to many relationship will be lost. Both the objects will be independent.

5. Have u done  Deployment ?
Yes. ANT tool, Force.com IDE and Change Set.

6. How do you Transfer Reports from one org to org?
Through deployment.

7. Reports From production to sandbox?
Through deployment and through sandbox refresh.

8. Where we use contracts?
Entitlement Management.

9. Does Validation rule run on delete?
No.

10. Field Description – long text , edited the description , Today – a  , tomorrow – b , Day after  tomorrow – c ,  ( Track all the changes )
Feed Tracking can be used.

11. What does Test/Design Documents include and how you prepare them
From the requirement.

12. Types of workflow
Email Alert, Task, Field Update, Outbound Message.

13. Why we use record type in reports?
http://www.infallibletechie.com/2013/05/record-types-in-salesforce.html

14. What are permission sets?
http://www.infallibletechie.com/2012/11/what-are-permission-sets-and-how-do.html

15. How do we assign permission sets?
Go the user record and in the Permission Set Assignment related list, we can assign.

16. Types of reports
Tabular, Summary, Matrix and Joined

17. What is sharing rules?
http://www.infallibletechie.com/2012/11/sharing-rules.html

18. If two users bare the same position in a org how one can access the others records in his absence.
By default they cannot see. Using Team, it can be shared.

19. What is queues?
http://www.infallibletechie.com/2014/02/difference-between-queue-and-public.html

20. Difference between roles, permission sets and profiles
http://www.infallibletechie.com/2012/12/difference-between-roles-and-profiles.html

21. Define master-detail & lookup relationship
http://www.infallibletechie.com/2013/02/difference-between-lookup-and-master.html

Cheers!!!

Life Cycle of Salesforce

1. Plan

2. Analyze

3. Design

4. Build

5. Validate

6. Deploy

Cheers!!!

Campaign Influence in Salesforce

Campaign Influence in Salesforce is used to associate multiple influential campaigns to a single opportunity.

View influential campaigns from the Campaign Influence related list on the opportunity detail page. The Primary Campaign Source field on an opportunity detail page allows you to designate the most influential campaign for that opportunity.

1. Go to Customize --> Campaigns --> Campaign Influence.


2. Save the Campaign Influence.


3. You can add campaigns to Opportunities using Campaign Influence related list.


Cheers!!!

How to know the picklist replace status in Salesforce?

To know about Picklist replace option, check the below link

http://www.infallibletechie.com/2013/03/what-is-use-of-replace-in-picklist-in.html

To know the status, check the below

1. Once you replace, you will be able to see a screen as below.


2. Click Backgound Jobs Page link to view the status.



Note:
You will receive an email too.

Cheers!!!

How to use Query inside Query in SOQL?

Sample SOQL:

List<Account> listAccount = [SELECT Id, Name FROM Account WHERE Id IN (SELECT AccountId FROM Opportunity)];

system.debug('Output is ' + listAccount);

Cheers!!!

How to write code for try catch in test class in Salesforce?

Sample Class:

public class LeadCreation {
    public Lead objLead;
    public String lastName;
    public LeadCreation() {
        
    }
    public PageReference newLead() {
        objLead = new Lead(Company = 'Test', LastName = lastName, Status = 'Open - Not Contacted');
        try {
            insert objLead;
            PageReference pg = new PageReference('/' + objLead.Id);
            pg.setRedirect(true);
            return pg;
        } catch(DMLException e) {
            return null;
        }
    }
}

Test Class:

@isTest
private class LeadCreationTest {
    @isTest static void leadTest() {
        LeadCreation obj = new LeadCreation();
        try {
            obj.newLead();
        } catch(DMLException e) {
            system.assertEquals(e.getMessage(), e.getMessage());
        }
        obj.lastName = 'Testing';
        obj.newLead();
    }
}

Note:

This code is written in a way to just cover catch block.

Cheers!!!

Lead with Inactive Owners Report in Salesforce

1. Go to Report Types.


2. Create a new Lead Report Type.


3. Save the Custom Lead Report Type.


4. Click "Edit Layout".


5. Select "Add fields related via lookup".


6. Select Lead Owner.


7. Select Active field and save.


8. Create a Report with the custom report type created now.


9. Add Active equal to false in the report criteria.


Cheers!!!

How to cover PageReference method in test class in Salesforce?

Sample Apex Class:

public class Sample {
    public Sample() {
    }
    
    public PageReference goToInfallible() {
        PageReference pg = new PageReference('http://www.infallibletechie.com');
        pg.setRedirect(true);
        return pg;
    }
}

Test class:

@isTest
private class SampleTest {
    @isTest static void test() {
        Sample s = new Sample();
        s.goToInfallible();
    }
}

Cheers!!!

Custom Metadata Types

Custom metadata is customizable, deployable, packageable, and upgradeable application metadata. First, you create a custom metadata type, which defines the form of the application metadata. Then you build reusable functionality that determines the behavior based on metadata of that type. Similar to a custom object or custom setting, a custom metadata type has a list of custom fields that represent aspects of the metadata. After you create a public custom metadata type, you or others can declaratively create custom metadata records that are defined by that type. When you package a public custom metadata type, customers who install the package can add their own records to the metadata type. Your reusable functionality reads your custom metadata and uses it to produce customized application behavior.

Custom metadata rows resemble custom object rows in structure. You create, edit, and delete custom metadata rows in the Metadata API or in Setup. Because the records are metadata, you can migrate them using packages or Metadata API tools. Custom metadata records are read-only in Apex and in the Enterprise and Partner APIs.

Custom Metadata Types are similar to Custom Settings. Let's see an example to use it in Salesforce.

1. Go to Custom Metadata Types.


2. Click "New Custom Metadata Type".


3. Save Custom Metadata Type.


4. Click "New" in Custom Fields section.


5. I have created a Field with API name Name__c.

6. Click Manage to create records.


7. Click "New" to create records.


8. Save a test record.


9. To see the records in a VF page use the below code

Visualforce page:

<apex:page controller="Sample">
<apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!listEmpSettings}" var="e">
            <apex:column value="{!e.DeveloperName}"/>
            <apex:column value="{!e.Name__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>

Apex Controller:

public class Sample {
    public List<Employee_Setting__mdt> listEmpSettings {get;set;}
    public Sample() {
        listEmpSettings = [SELECT DeveloperName, Name__c FROM Employee_Setting__mdt];
    }
}

Output:


Cheers!!!

Customer Engagement Score

The customer engagement score is a single number that is used to measure how engaged your customers and free trial prospects are. Each customer has their own score based on activity and usage of your product and services. The higher the score, the healthier and happier the customer.

An engaged customer, is a customer that best gets the value out of your product or service.

When we talk about customer engagement, it’s common to see people taking into consideration usage metrics only like visits, clickstream, pages per session, time on web site, etc.

Cheers!!!

Salesforce WINTER ’16 Overview

Custom Metadata Types
http://www.infallibletechie.com/2015/11/custom-metadata-types.html

CRUD for External Objects
Salesforce now supports CRUD permission for External Objects records.

Lightning Experience

Sales Wave Analytics App

Omni-Channel

Lightning Experiece for Custom Objects

Next Generation Journey Builder

Next Generation Community Builder

Picklist Replace
http://www.infallibletechie.com/2015/11/how-to-know-picklist-replace-status-in.html

Roll up Summary Field
Now we can create 25 roll up summary fields per object. Previously it was 10.

Cheers!!!

Searchable fields in Salesforce

Custom object records are searchable in the Salesforce user interface only if the custom object is associated with a custom tab. Users aren't required to add the tab for display.

All custom fields of type email and phone are available in Side bar search, Global Search and Advanced search.

All custom fields of type text, text area, long text area, and rich text area are available in Global Search and Advanced search.

Note:

When you search for a value in a field that's hidden from you by field-level security, your results include the record that contains the field. However, you can't see the field.

Cheers!!!

SmartStore

Mobile devices can lose connection at any time, and environments such as hospitals and airplanes often prohibit connectivity. To handle these situations, it’s important that your mobile apps continue to function when they go offline.

Mobile SDK provides SmartStore, a multithreaded, secure solution for offline storage on mobile devices. With SmartStore, your customers can continue working with data in a secure environment even when the device loses connectivity.

SmartStore stores data as JSON documents in a simple, single-table database. You can define indexes for this database, and you can query the data either with SmartStore helper methods that implement standard queries, or with custom queries using SmartStore’s Smart SQL language.

Cheers!!!

How to read CSV file in Selenium JAVA WebDriver?

1. Go to http://sourceforge.net/projects/opencsv/ and download the opencsv jar file. Add the Jar file to your JAVA project.

2. Use the below Lirbraries.

import com.opencsv.CSVReader;
import java.io.FileReader;

3. Sample Code:

    String CSV_PATH = "D:\\demo.csv";
    CSVReader reader = new CSVReader(new FileReader(CSV_PATH));
    String [] csvCell;
    while ((csvCell = reader.readNext()) != null) {   
    String acctName = csvCell[0];
    String acctType = csvCell[1];
    String acctIndustry = csvCell[2];
    String acctSource = csvCell[3];
    String acctRating = csvCell[4];
    String acctOwnership = csvCell[5];
    String acctActive = csvCell[6];
    String acctPriority = csvCell[7];
    String billingStreet = csvCell[8];
    String billingCity = csvCell[9];
    String billingState = csvCell[10];
    String billingPostalCode = csvCell[11];
    String billingCountry = csvCell[12];
    String mailingStreet = csvCell[13];
    String mailingCity = csvCell[14];
    String mailingState = csvCell[15];
    String mailingPostalCode = csvCell[16];
    String mailingCountry = csvCell[17];
    }

Cheers!!!

How to avoid closing of browser in Selenium WebDriver?

Remove the "driver.quit();" to avoid closing of browser in Selenium WebDriver.

"driver.quit();" will be usually in the method where @After annotation is used.

Note:

Be very careful in removing "driver.quit();" this code since it may cause failure in some kind of tasks where "driver.quit();" is used explicitly for their requirement.

Cheers!!!

System.UnexpectedException: No more than one executeBatch can be called from within a testmethod. Please make sure the iterable returned from your start method matches the batch size, resulting in one executeBatch invocation.

If you face "System.UnexpectedException: No more than one executeBatch can be called from within a testmethod. Please make sure the iterable returned from your start method matches the batch size, resulting in one executeBatch invocation." issue, make sure execute method inside the batch is not called more than once.

Example:

I have a controller, where I am calling a batch class where the batch size is 4. If I have created 8 records in the test class, it will fail since the execute method will be called twice.

So, make sure the execute method is called only once.

Note:

1. Make sure seeAllData=true is not used in test class since it fetches all the data from the object.

2. Check the batch size and records created in test class.

Cheers!!!

Running User in Salesforce Dashboard

Each dashboard has a running user, whose security settings determine which data to display in a dashboard. If the running user is a specific user, all dashboard viewers see data based on the security settings of that user—regardless of their own personal security settings. For this reason, you’ll want to choose the running user wisely, so as not to open up too much visibility. For example, set the Sales Manager as the running user for a leaderboard for her team. This allows her team members to view the leaderboard for their individual team, but not other teams.

For dynamic dashboards, you can set the running user to be the logged-in user, so that each user sees the dashboard according to his or her own access level. If you’re concerned about too much access, dynamic dashboards might be the way to go.

Cheers!!!

Test class to cover Catch block in Salesforce

Sample Class:

public class LeadCreation {
    public Lead objLead;
    public String lastName;
    public LeadCreation() {
        
    }
    public PageReference newLead() {
        objLead = new Lead(Company = 'Test', LastName = lastName, Status = 'Open - Not Contacted');
        try {
            insert objLead;
            PageReference pg = new PageReference('/' + objLead.Id);
            pg.setRedirect(true);
            return pg;
        } catch(DMLException e) {
            return null;
        }
    }
}

Test Class:

@isTest
private class LeadCreationTest {
    @isTest static void leadTest() {
        LeadCreation obj = new LeadCreation();
        try {
            obj.newLead();
        } catch(DMLException e) {
            system.assertEquals(e.getMessage(), e.getMessage());
        }
        obj.lastName = 'Testing';
        obj.newLead();
    }
}

Note:

This code is written in a way to just cover catch block.

Cheers!!!

How to cover Catch block in test class in Salesforce?

Sample Class:

public class LeadCreation {
    public Lead objLead;
    public String lastName;
    public LeadCreation() {
        
    }
    public PageReference newLead() {
        objLead = new Lead(Company = 'Test', LastName = lastName, Status = 'Open - Not Contacted');
        try {
            insert objLead;
            PageReference pg = new PageReference('/' + objLead.Id);
            pg.setRedirect(true);
            return pg;
        } catch(DMLException e) {
            return null;
        }
    }
}

Test Class:

@isTest
private class LeadCreationTest {
    @isTest static void leadTest() {
        LeadCreation obj = new LeadCreation();
        try {
            obj.newLead();
        } catch(DMLException e) {
            system.assertEquals(e.getMessage(), e.getMessage());
        }
        obj.lastName = 'Testing';
        obj.newLead();
    }
}

Note:

This code is written in a way to just cover catch block.

Cheers!!!

What is the difference between External lookup relationship and Indirect lookup relationship

External lookup relationship

External lookup relationship links a child standard, custom, or external object to a parent external object. The values of the standard External ID field on the parent external object are matched against the values of the external lookup relationship field. For a child external object, the values of the external lookup relationship field come from the specified External Column Name.

In External lookup relationship, External Object will be the parent.

Indirect lookup relationship

Indirect lookup relationship links a child external object to a parent standard or custom object. You select a custom unique, external ID field on the parent object to match against the child’s indirect lookup relationship field, whose values are determined by the specified External Column Name.

In Indirect lookup relationship, Salesforce standard or custom object will be the parent and External Object will be the child.

Cheers!!!

An external object with the API name Phone_Plan__x does not exist Salesforce Trailhead challenge

1. Go to External Objects.


2. Edit both the objects to change the API names as below.



Cheers!!!

Assistant in Salesforce

The Assistant is a smart list of things to do today, featuring a blended set of tasks and opportunities that need your attention.

Looking at our to-do list, we see that one of our biggest opportunities hasn’t had any activity recently, and we also have an overdue task from yesterday related to a lead we’ve been working diligently to convert.

Cheers!!!

Alias in Salesforce User Creation

An alias is a short name to identify the user on list pages, reports, or other places where their entire name doesn't fit.

By default, the alias is the first letter of the user's first name and the first four letters of their last name.

Cheers!!!

How to save chat history at agent side in Salesforce Live Agent?

We can use Live agent chat transcript. A live chat transcript is a record of a chat between a visitor and a live chat agent. Salesforce creates a transcript automatically for each chat session.

For chats that are successfully completed and are ended by either the visitor or the support agent, a transcript is created as soon as the agent closes the chat window and, if applicable, any tabs associated with it in the Service Cloud console. For chats that end due to disconnection issues or other errors, transcripts are created by a cleanup process, which can take up to 30 minutes to run.


For details please refer following links,

https://help.salesforce.com/apex/HTViewHelpDoc?id=live_agent_transcript_overview.htm&language=en_US

https://help.salesforce.com/apex/HTViewHelpDoc?id=live_agent_viewing_editing_transcripts.htm&language=en_US

https://help.salesforce.com/apex/HTViewHelpDoc?id=live_agent_setting_up_chat_transcripts.htm&language=en_US

Cheers!!!