Concepts or coding lessons of Salesforce that you can implement easily

Showing posts with label Salesforce Interview Questions. Show all posts
Showing posts with label Salesforce Interview Questions. Show all posts

Salesforce Interview Questions - Part 4

81. How to get the debug log of Connection user in salesforce to salesforce Integration?
Answer
When configuring Debug Logs, you cannot choose a Salesforce to Salesforce Connection User from the User Lookup, but there is a workaround to achieve this.

To begin capturing Debug Logs for a Connection User open the following URL in your browser:
https://YOURSALESFORCEINSTANCE.salesforce.com/p/setup/layout/AddApexDebugLogUser?retURL=%2Fsetup%2Fui%2FlistApexTraces.apexp&UserLookupInput_lkid=YYYYYYYYYYYYYY
&UserLookupInput=Connection%20User
Replace YOURSALESFORCEINSTANCE with your salesforce instance, UserLookupInput_lkid is the ID of the Connection User and UserLookupInput is the User name. You can find the user ID of the connection user, by inspecting the CreatedById for a record created by this user. (eg. via eclipse or Force.com explorer)

82. What are different user licenses available in salesforce and explain them?
Answer : Below is the list of licenses available in salesforce
1)     Salesforce : Full access to salesforce CRM and appExchange
2)     Salesforce Platform : Access only to Custom apps but not standard CRM
3)     Force.com One App : Designed to access only one custom app with unlimited number of tabs
4)     Force.com Knowledge Subscription : Grant user access to Force.com Light app or Force.com enterprise app but no CRM functionality
5)     Knowledge Only User :Designed for users who only need access to the Salesforce Knowledge app
6)     Chatter Free : User has access to chatter which includes feeds, profiles, files and groups 
7)     Chatter External : Designed to allow customers in Chatter groups. Customers are users outside of a company’s email domain.
8)     Chatter Only : User has access to Groups, feeds, people, profiles and files along with access to view accounts and contacts, modify custom objects and use CRM contents, Ideas.

83. What is the difference between Customer portal and Partner portal?
Answer : Traditionally Partner Portal is part of companies Partner Channel Sales efforts. It is a portal focused more on Sales force automation and the efforts of those partners that sell your products to nurture the leads you pass to them, the leads they enter in themselves and the convert to Opportunity and subsequent sale.

Customer Portal on the other hand is more focused on the Service and Support of one’s Customers.

The feature differences are that Partner Portal exposes the Leads and Opportunity objects whereas the Customer Portal does not. However, only the top tier of Partner licensing (Gold Partner licenses) exposes the Case object whereas this is standard in the Customer Portal.

84. What is a Solution in Salesforce?
Answer 
• An answer to a common question or problem
• Enables Customer Support users get up to speed quickly
• Enables Support teams to answer questions quickly and consistently
• Customers search for and browse published Solutions to self assist
• Content-Rich Solutions are an enhancement to the Solution Object which allows solution writers to integrate rich text and
images into their solutions to completely solve a problem

85. Explain Lead conversion?
Answer 
Lead can be converted in salesforce.com and the converted information is mapped to the appropriate business objects – Account, Contact or Opportunity

• The system automatically maps standard lead fields to standard account, contact, and opportunity fields
• For custom lead fields, your administrator can specify how they map to custom account, contact, and opportunity fields
• The system assigns the default picklist values for the account, contact, and opportunity when mapping any standard lead picklist fields that are blank. If your organization uses record types, blank values are replaced with the default picklist values of the new record owner.
• If the lead has a record type, the default record type of the new owner is assigned to records created during lead conversion.

86. Explain the lead conversion process in salesforce?
Answer : When you convert a lead, the standard lead fields are automatically converted to the new account, contact, and, optionally, an opportunity using the information from the lead.
Custom lead fields are converted to custom account, contact, and opportunity fields as specified by your administrator.
All open and closed activities from the lead are attached to the account, contact, and opportunity.


87. What are differences between workflows and approval process?
Answer 
The key difference between workflows and approval process are as below
Workflow rules consist of single step and a single action where as approval process has multiple steps and different actions.
Workflow rules trigger automatically and the rules when triggered are not visible to the user. Approval process on the other hand, contains multiple step s each requiring a specific "I Approve or Reject" user action by the specified approvers.


88. Tell me about Jump Start Wizard versus Standard Wizard in Salesforce?
Answer 
The Jump Start wizard creates a one-step approval process for you in just a few minutes
The Standard Wizard is useful for complex approval processes.

Jump Start Wizard
• The jump start wizard is useful for simple approval processes with a single step.
• Use the jump start wizard if you want to create an approval process quickly by allowing Salesforce to automatically choose some default options for you.

Standard Wizard
• The standard wizard is useful for complex approval processes.
• Use it when you want to fine tune the steps in your approval process.
• The standard wizard consists of a setup wizard that allows you to define your process and another setup wizard that allows you to define each step in the process.

89. What is the Parallel Approval Routing ?
Answer :
Parallel Approval Routing is sending approval requests to multiple approvers in a single step Wait for approval from all the approvers or wait for approval from any one
Configure an approval step to request approval from any combination of multiple users and related users
Configure 25 parallel approvers at each step.

90. What are the Time-Dependent Workflow – Considerations ?
Answer :
Maximum of 10 time triggers per rule
Maximum of 40 actions (10 x 4 types) per time trigger, and 80 actions per workflow rule
Workflow default user must be set up before creating time-based rules
Precision limited to hours or days
Cannot convert leads with time-dependent actions in the Workflow Queue
Time triggers cannot be added to or removed from activated workflow rules
Not possible to create a time-dependent action associated to a rule with a trigger type of Every time the record is created or updated

91. What are the Time-Dependent Workflow Limitations ?
Answer :
Time triggers don’t support minutes or seconds.
Time triggers can’t reference the following:
•  DATE or DATETIME fields containing automatically derived functions, such as TODAY or NOW.
•  Formula fields that include related-object merge fields.

You can’t add or remove time triggers if:
•  The workflow rule is active.
•  The workflow rule is deactivated but has pending actions in the queue.
•  The workflow rule evaluation criteria are set to Evaluate the rule when a record is: created, and every time it’s edited.
•  The workflow rule is included in a package

92. We have a Time Based Workflow and there is Action scheduled to be executed. If we Deactivate the workflow, Scheduled actions will be removed from queue or not?
Answer :
Even after deactivation of workflow, its action will be active in queue.

93. We have Time Based Workflow and there is action scheduled to be executed. Can we delete that workflow?
Answer : If a workflow has any pending time dependent action, then we cannot delete the workflow.

94. How to clear the Time based workflow action queue?
Answer 
Two ways to achieve this: 
1. Make criteria false for all those records. 
2. Navigate to Set up -> Monitoring -> Time Based Workflow, search for scheduled actions and remove from queue.

95. When the Add Time Trigger button is unavailable?
Answer :
The evaluation criteria are set to Evaluate the rule when a record is: created, and every time it’s edited.
The rule is activated.
The rule is deactivated but has pending actions in the workflow queue.

96. In salesforce which fields are indexed automatically?
Answer :
The following fields are indexed by default:
•  primary keys (Id, Name and Owner fields),
•  foreign keys (lookup or master-detail relationship fields),
•  audit dates (such as LastModifiedDate),
•  Custom fields marked as External ID or Unique

97. What is a Category in Salesforce ?
Answer :
• Mechanism to organise Solutions
• Solutions may be associated to one or more Categories
• Categories make up a Solution Category tree structure
What are Suggested Solutions?
• The suggested solutions feature displays up to ten relevant solutions that may help users and customers solve a particular case from the case detail page and the Self-Service portal.
• Suggested Solutions can be enabled for the following:
Cases tab
Self Service Portal
Case auto-response rules and emails.

98. What are different Organization Wide Defaults? Explain each of them?
Answer :
Below are the different OWD values :
Private
    If the OWD for an object is set to private, then only the owner, and users above that role in role hierarchy, can view, edit and report on those records
Public Read Only :
    If the OWD for an object is set to Public Read Only, then all users can view and report on records but they cannot edit them. Only the record owner and the users above that role in the role hierarchy can edit the records
Public Read/Write :
If the OWD for an object is set to Public Read/Write, then all users can view, edit and report on all records. But only owner of the record can delete the records.

Public Read/Write/Transfer :
This is available only for Case and Lead objects
If the OWD for an object is set to Public Read/Write/Transfer then, all users can view, edit, Transfer and report on all the records but only owner of the record can delete the records

Public Full Access :
This is available only for Campaign object.
If the OWD for Campaigns are set Public Full Access then, all users can view, edit, delete and report on all records.

No Access, View Only or Use :
This is available only for Price Book object.
If the OWD for Price Book is set Use then, all users can access the Price Book information and as well as using the Price Book configuration for Opportunities with Products.
If the OWD for Price Book is set View Only then, all users can access the Price Book information but not to use that Price Book detail in Opportunities with Products
If the OWD for Price Book is set No Access then, it restricts users from accessing information for Price Book and Prices.

Controlled By Parent :
If the OWD for any object is set as Controlled By Parent, then user can perform an action on the record based on whether they can do the same on the parent record associated with it.

99. What are differences between custom settings and custom objects?
Answer :
Custom Settings:
1. Custom settings are SOQL inexpensive
2. We can’t write triggers on custom settings
3. Fields on which we can create custom settings are restricted like picklists, lookups and formula fields can’t be created in custom settings
4. No Page layouts, record types, validation rules and workflow rules can be used on custom settings.
5. Custom Settings SOQL is faster than custom objects.

Custom Objects:
1. Custom Objects are SOQL Expensive
2. We can have triggers on custom objects
3. No restrictions on creation of fields
4. Can be used on Custom objects
5. Custom objects SOQL not fast as a custom Settings . 

100. How to get all the required fields of sObject dynamically?
Answer :
There is no direct property available in Apex dynamic API to represent the required field. However there is another way to know about it.
If any fields have below three properties then it is mandatory field.
1. If it is Creatable
2. If it is not nillable and
3. If it does not have any default value

Map<String, Schema.SObjectType> m  = Schema.getGlobalDescribe() ;
Schema.SObjectType s = m.get(so.apiName) ; // Like Account object
Schema.DescribeSObjectResult r = s.getDescribe() ;
Map<String,Schema.SObjectField> fields = r.fields.getMap() ;
for(String f : fields.keyset())
{
    Schema.DescribeFieldResult desribeResult = fields.get(f).getDescribe();
    if( desribeResult.isCreateable()  && !desribeResult.isNillable() && !desribeResult.isDefaultedOnCreate() )
    {
//This is mandatory / required field
    }
}


More Salesforce Interview Questions and Answers:

Salesforce Interview Questions - Part 3

51. What is the difference between apex:dataTable and apex:pageBlockTable components in Visualforce?
Answer : Both component is used to render data in tabular format. apex:dataTable will render records in simple HTML table format whereas the apex:pageBlockTable possess default look and feel of salesforce standard CSS and must be written inside apex:pageBlock component.

52. How to get all records even from recycle bin or Achieved Activities using SOQL query?
Answer : We will need ALL Rows clause of SOQL.
Example :
SELECT COUNT() FROM Opportunity WHERE AccountId = acc.Id ALL ROWS

53. How can you lock record using SOQL so that it cannot be modified by other user.
Answer : We will need FOR UPDATE clause of SOQL.
Example :
SELECT Id FROM Contact LIMIT 2 FOR UPDATE

54. In trigger, lets say you have system.debug() statement after adderror() method. Will system.debug() be statement executed in Trigger after adderror() method?
Answer: adderror() method is not error statement rather its normal execution flow and all the statements written after adderror() will be executed normally.

55. How to get total number of Child records in Lookup relationship?
Answer: As Rollup Summary field is only supported in Master detail, we cannot use it for Lookup. 
There are following two ways.

1. Inline Visualforce page
2. Trigger on Child Object, which will update field in Parent record if child record is inserted, deleted or undeleted.
If anyone has any other idea please comment. I will add that too.

56. What will happen if you try to update record in After Trigger Context?
Answer : You will get an error saying record is Read only.

How to get IP Address of User in Apex?
Answer : String ipAddress = ApexPages.currentPage().getHeaders().get('X-Salesforce-SIP');

X-Salesforce-SIP has the value if there is no caching integration (sandbox, developer edition orgs) or via the secure URL.

57. We have a Time Based Workflow and there is Action scheduled to be executed. If we Deactivate the workflow, Scheduled actions will be removed from queue or not?
Answer : Even after deactivation of workflow, its action will be active in queue.

58. How to clear the Time based workflow action queue ?
Answer : Two ways to achieve this. 
  • Make criteria false for all those records. 
  • Go to Set up -> Monitoring -> Time Based Workflow and search for scheduled actions and then remove from queue.
59. We have Time Based Workflow and there is action scheduled to be executed. Can we delete that workflow?

Answer : If a workflow have any pending time dependent action, then we cannot delete the workflow.

60. While creating workflow on Task object, what difference observed on available actions?
Answer : Send Email action is not available while creating workflow on task object.

61. Explain few considerations for @Future annotation in Apex.
Answer 
Remember that any method using the future annotation requires special consideration because the method does not necessarily execute in the same order it is called.
  • Methods with the future annotation cannot be used in Visualforce controllers in either getMethodName or setMethodName methods, nor in the constructor.
  • You cannot call a method annotated with future from a method that also has the future annotation. Nor can you call a trigger from an annotated method that calls another annotated method.
  • Method must be static
  • Cannot return anything i.e. ( Only Void )
  • Parameter to @future method can only be primitive or collection of primitive data type.
  • To test @future methods, you should use startTest and stopTest to make it synchronous inside Test class.
62. How you can use Datetime field as a criteria in SOQL Query ?
Answer 
We cannot use Datetime as condition in Where Clause in between single Quotes.
You can do something like this ,
WHERE CreatedDate > 2017-01-02T00:00:00Z
OR you can also use Date Literals like
WHERE CreatedDate > YESTERDAY

63. Why I am not able to find list of Person Account fields in Field Level Security (FLS) settings when navigated to fields on Account Object.
Answer :

Field Level Security (FLS) of Person Account fields are controlled by Contact Fields. So, if you want to setup FLS of Person Account Fields navigate to fields of Contact and it will be reflected on Person Account.

64. Explain functionality of Force.com Query Optimizer.
Answer :
The Force.com query optimizer:

  • Determines the best index from which to drive the query, if possible, based on filters in the query
  • Determines the best table to drive the query from if no good index is available
  • Determines how to order the remaining tables to minimize cost
  • Injects custom foreign key value tables as needed to create efficient join paths
  • Influences the execution plan for the remaining joins, including sharing joins, to minimize database input/output (I/O)
  • Updates statistics

65.How to report on User License field?
Answer :
Create formula field in User Object with formula Profile.UserLicense.Name.
Note: You need to copy and paste this value because it doesn’t show up in the fields drop down.

66. Explain Skinny table in Salesforce.
Answer :
Salesforce creates skinny tables to contain frequently used fields and to avoid joins, and it keeps the skinny tables in sync with their source tables when the source tables are modified. To enable skinny tables, contact Salesforce.com Customer Support.
For each object table, Salesforce maintains other, separate tables at the database level for standard and custom fields. This separation ordinarily necessitates a join when a query contains both kinds of fields. A skinny table contains both kinds of fields and does not include soft-deleted records.

67. What are the considerations for Skinny Table?
Answer :

  • Skinny tables can contain a maximum of 100 columns.
  • Skinny tables cannot contain fields from other objects.
  • Skinny tables are not copied to sandbox organizations. To have production skinny tables activated in a sandbox organization, contact Salesforce.com Customer Support.

68. How to capture errors after using Database DML methods in Salesforce?
Answer :
List<Contact> lstContact = new List<Contact>();
Contact con = new Contact (lastName = 'Talekar', SQL_Server_Id__c='3',firstName='Nitish');
lstContact.add(con);
// add some other contacts records in contact List
Database.UpsertResult[] results = Database.upsert( lstContact, Contact.SQL_Server_Id__c.getDescribe().getSObjectField() ,false ) ;

for(Integer i=0;i<results.size();i++){
    if (!results.get(i).isSuccess()){
        Database.Error err = results.get(i).getErrors().get(0);
        System.debug('Error - '+err.getMessage() + '\nStatus Code : '+err.getStatusCode()+'\n Fields : '+err.getFields());
    }
}

69. Which fields are automatically Indexed in Salesforce ?
Answer :

  • RecordTypeId
  • Division
  • CreatedDate
  • Systemmodstamp (LastModifiedDate)
  • Name
  • Email (for contacts and leads)
  • Foreign key relationships (lookups and master-detail)
  • The unique Salesforce record ID, which is the primary key for each object.

70. Which fields cannot be added as a custom Index?
Answer :

  • multi-select picklist
  • text area (long)
  • text area (rich)
  • non-deterministic formula fields (Like any formula field using function NOW() or Today() )
  • encrypted text fields.

71. What is best practice to refer dynamic custom messages in Visualforce with multi-language support ?
Answer :
Using Custom Label or OutputField or InputField tag, Platform itself will take care of internationalization. However in some cases, Message needs to be dynamic at the same time it should also support muti-language. In Custom Label, we cannot save dynamic String.

Let’s assume we want to show message something like “DEVELOPERNAME is not authorized to access this page”.
Here, Developername should be dynamically changed in visualforce which supports multilanguage. For each developername, it is not feasible to create custom labels. So below workaround can be used :

Step 1 : Create a Custom Label with text  {0} is not authorized to access this page. In every language, dynamic value should represented by {0}.

Step 2 : In Controller of Visualforce write something like this :

String developerName = 'Some Developer Name';
String message = String.format(Label.DEVELOPERNAME , new String[] { developerName });


72. What are the tools included in lightning ?
Answer :

Lightning Component Framework – Components and extensions that allow you to build reusable components, customise the Salesforce1 Mobile App, and build standalone apps.
Lightning App Builder – A new UI tool that lets you build apps lightning fast, using components provided by Salesforce and platform developers.
Lightning Connect – An integration tool that makes it easier for your Force.com app to consume data from any external source that conforms to the OData spec.
Lightning Process Builder – A UI tool for visualizing and creating automated business processes.
Lightning Schema Builder – A UI tool for viewing and creating objects, fields, and relationships.

73. Difference between Chatter API and Connect API in Salesforce.
Answer :

Chatter API is REST API for Chatter to display Salesforce data, especially in mobile applications. Responses are localized, structured for presentation, and can be filtered to contain only what the app needs.
Connect API provides apex classes for accessing the same data available in Chatter REST API. Use Chatter in Apex to create custom Chatter experiences in Salesforce.

74. What the Concurrent Request Limit is and Why it Exists in Salesforce?
Answer :
The multi tenant Force.com platform uses governor limits to ensure that system resources are available to all customers and to prevent any one customer from monopolizing them. If a governor limit is exceeded, the associated execution governor limit issues a runtime exception that cannot be handled. When you design your applications, you can help plan for their growth by keeping these limits in mind.

One of the limits customers frequently reach is the concurrent request limit. Once a synchronous Apex request runs longer than 5 seconds, it begins counting against this limit. Each organisation is allowed 10 concurrent long-running requests. If the limit is reached, any new synchronous Apex request results in a runtime exception. This behavior occurs until the organization’s requests are below the limit.

Ultimately, this limit is in place to protect the user experience. Once the limit is reached, new synchronous Apex requests are denied. This behaviour can be disruptive to your work.

Some useful tips:
  • Convert synchronous processes to asynchronous processes. Batch Apex might be a viable alternative. Limit synchronous Web service callout.
  • Use the Streaming API instead of polling
  • Tune SOQL and DML operations. Make sure that your queries are selective. Limit the number of records in your list views. Avoid data skew.
75: What is custom metadata type ?
Answer : 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.
Before Custom metadata type, we were using Custom settings of List type. Problem with custom setting was that, during migration or in packages, data were not migrated. We had to either use data loader or some API to create initial data. However, if we package custom metadata type or migrate it, data will also be migrated along with it.

76: Which component in Salesforce ends with __mdt and __s ?
Answer : Custom metadata types ends with __mdt (meta data type), just like custom object or custom fields ends with __c.

When we create Geolocation field in Salesforce, lets say by name location__c then internally Salesforce creates subfields with extension __s
In this case location_latitude__s and location_longitude__s.

77: Which interface needs to be implemented in Apex to be used in Flow ?
Answer : We can execute apex as well using flow by annotating it with @InvocableMethod and marking method as static. However this method only takes one parameter of type list. If we want to send multiple parameters, then simplest way is to create comma separated list of argument and pass it. In this method, we can break it and use according. 
Below is sample code

Global class Flow_UpdateContactField {    
    @InvocableMethod
    public static void performUpdate(List<String> lstCSV){
        List<String> recIds = lstCSV[0].split(',');
        // 0 - ContactId, 1-field1__c
Contact objCon = new Contact(Id=recIds[0], field1__c=recIds[1]);
update objCon;        
    } 

}

78: How to get the list of all available sobject in salesforce database using Apex (Dynamic Apex) ?
Answer :
Map<String, Schema.SObjectType> m =  Schema.getGlobalDescribe();

79. How to display error messages in the visualforce page ?
Answer :
In Apex use below code to create the error message for visualforce.
Apexpages.addMessage( new ApexPages.Message (ApexPages.Severity.ERROR, 'Required fields are missing. '));
And in Visualforce page,  add below tag where you want to display the error message which display the error message.

<apex:pageMessages > </apex:pageMessages>

80: How to read the parameter value from the URL in Apex?
Answer :
Consider that the parameter name is AccountName then use below code snippet:

String objAccountName = Apexpages.currentPage().getParameters().get('AccountName');

More Salesforce Interview Questions and Answers:

Salesforce Interview Questions - Part 2

31. What is a report type?
Answer - A report type is a skeleton over which you can build the report. It specify the structure of your report(Object relationship). Salesforce provides standard report types using which reports can be build. If the standard type does not suffice your requirement then we have to go for custom report type. It allows to build framework from which reports can be created. While building report type we need to select object and the relationship between objects to display in report. Which fields will be available for display can also be set.

32. What are analytical snapshot?
Answer - Analytical snapshots can be used to schedule a report run and then save the report result as records in custom object. While building a analytical snapshot we have to select a source report and destination object. Then map the fields from report and object. The report runs at specified time and then inserts the report result as records in that object. Advantages that we get through analytical snapshot are as below, Runs reports faster, Sort and filter data using list views, can view trend in data via object records. The object selected for record insertion should not have any insert trigger on it.


Accelerate Career in Salesforce with Force.com Enterprise Architecture !!! 

33. What are various standard exceptions that salesforce throws?
Answer - salesforce throws number of standard exception . Some of the important ones are as below-
dmlexception, listexception, email exception, calloutexception, JSONexception, mathexception, Queryexception, sObjectexception, xmlexception, typeexception, visualforceexception, stringexception, searchexception, nullpointerexception, noaccessexception.
34. What are the various ways of deployment in salesforce?
Answer - Metadata components in salesforce can be deployed using various ways as below
         Change set, Eclipse IDE, ANT, Workbench  

35. How can you expose a apex class as web service? and how to obtain a wsdl file for exposed class?
Answer - In order to expose a class as a webservice we have to use keyword 'webservice' with the method also the method should be global and also the class should be defined global. ex-
Global class DemoWebServiceClass{
 global webservices void myWebServiceMethod(){
 }
}
A wsdl file for a apex class can be obtained by using the button generate wsdl on class.
Learn how to on my another blog post: 7 Easy Steps to Generate Apex Class From WSDL In Salesforce

36. What is an account team?
Answer - Account team is group of users that work on a articular account. The users in a account team can be given access depending on the need. A account team appears as related list on account.

Build robust and scalable code architectures on the Force.com platform, for more information click Apex Design Patterns

37. What are the Different API's in salesforce ?
Answer 
Chatter REST API :
Chatter REST API provides programmatic access to Chatter feeds and social data such as users, groups, followers, and files. Use Chatter REST API to integrate Chatter into a variety of applications such as mobile applications, third-party Web apps and intranet sites.

REST API :
This api is used for accessing objects in organization through REST. Data format used is JSON, XML and communicates Synchronously. We can use this whenever we want to leverage the REST architecture to integrate with the salesforce environment. There is No WSDL required while using REST API. This is well-suited for browser based applications, mobile appslication, and social apps they are more interactive. It is uses REST protocol.
BULK API :
The Bulk API provides a programmatic option to quickly load your org’s data into Salesforce. Bulk API is based on REST principles and is optimized for loading or deleting large sets of data. You can use it to query, queryAll, insert, update, upsert, or delete many records asynchronously by submitting batches. Salesforce processes batches in the background.

SOAP API :
SOAP API provides a powerful, convenient, and simple SOAP-based web services interface for interacting with Salesforce. Protocol used is SOAP/WSDL, format is XML and communicates Synchronously. You can use SOAP API to create, retrieve, update, or delete records. You can also use SOAP API to perform searches and much more. Use SOAP API in any language that supports web services.

METADATA API :
Metadata API is intended for managing customizations and for building tools that can manage the metadata model, not the data itself. Here the SOAP API is oriented around accessing data and manipulating records, the Metadata API’s focuses on metadata. It gives you an API to manipulate layouts, classes, visualforce pages, Apex triggers. Protocol used is SOAP/WSDL. Format used is XML and communicates Asynchronously.

Tooling API :
This is used when one wants to manage and deploy working copies of Apex classes or triggers or Visualforce pages or other components.

Streaming API :
Use Streaming API to receive notifications for changes to Salesforce data that match a SOQL query you define, in a secure and scalable way. This enables one to reduce the number of API calls and improve performance.

38. What is the default batch size if we enable bulk API?
Answer : 2,000 records.

39. What is recursive workflow rule? How to avoid recursive workflow rules?

Answer
Whenever you enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update of a workflow rule, due to this field update other workflow rules on the same object will be fired if the entry criteria of those workflow rules satisfied.

And , You have other workflow rules also if you enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update recursive workflow rules will come in some scenarios.

We can take two steps to avoid recursive workflow rules :
  • For the workflow Evaluation Criteria if you choose created, and any time it’s edited to subsequently meet criteria option, we can avoid recursive workflow rules.
  • If you don't enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update of a workflow rule we can avoid.
40. What is the difference between database.insert and insert?
Answer :
Both DML statements perform same operation i.e. insert records.
Insert is the DML statement which is same as databse.insert.
However, database.insert gives more flexibility like rollback, default assignment rules etc. we can achieve the database.insert behavior in insert by using the method setOptions(Database.DMLOptions).

Important Difference:

If we use the DML statement (insert), then in bulk operation if error occurs, the execution will stop and Apex code throws an error which can be handled in try catch block.
If DML database methods (Database.insert) used, then if error occurs the remaining records will be inserted / updated means partial DML operation will be done.


41. What is the difference between 15 digit and 18 digit IDs in Salesforce?
Answer
15 digit ID in salesforce.com is case sensitive and 18 Digit Id is case-insensitive. Many applications does not support case sensitive strings, so in that case we can make use of 18 digit Id which is case in-sensitive.
15 digit Id number will have numeric digits range from (0-9), a Lowercase letter(a-z) or a Uppercase letters(A-Z). 15 digit ID in salesforce.com is case sensitive. Example 999999999999ABC  is different from 999999999999abc. When using external productive tools like Microsoft Excel, MS Access and SQL Server external ID’s are not case sensitive and they don’t recognize the difference between 999999999999ABC  and 999999999999abc.

Salesforce.com has recognized this problem and Salesforce.com has established 18 digit character insensitive ID. This 18 Digit ID is case insensitive which is formed by adding a suffix to the 15 Character Id number.

42. What are different types of reports?
Answer:
Tabular: Tabular reports are the simplest and fastest way to look at data. Similar to a spreadsheet, they consist simply of an ordered set of fields in columns, with each matching record listed in a row. Tabular reports are best for creating lists of records or a list with a single grand total. They can't be used to create groups of data or charts, and can't be used in dashboards unless rows are limited. Examples include contact mailing lists and activity reports.
Summary: Summary reports are similar to tabular reports, but also allow users to group rows of data, view subtotals, and create charts. They can be used as the source report for dashboard components. Use this type for a report to show subtotals based on the value of a particular field or when you want to create a hierarchical list, such as all opportunities for your team, subtotaled by Stage and Owner. Summary reports with no groupings show as tabular reports on the report run page.
Matrix: Matrix reports are similar to summary reports but allow you to group and summarize data by both rows and columns. They can be used as the source report for dashboard components. Use this type for comparing related totals, especially if you have large amounts of data to summarize and you need to compare values in several different fields, or you want to look at data by date and by product, person, or geography. Matrix reports without at least one row and one column grouping show as summary reports on the report run page.
Joined: Joined reports let you create multiple report blocks that provide different views of your data. Each block acts like a “sub-report,” with its own fields, columns, sorting, and filtering. A joined report can even contain data from different report types.
43. What are different kinds of dashboard component?
Answer:
Table: Use a table to show a set of report data in column form.
Visualforce Page: Use a Visualforce page when you want to create a custom component or show information not available in another component type
Custom S-Control: Custom S-Controls can contain any type of content that you can display or run in a browser, for example, a Java applet, an ActiveX control, an Excel file, or a custom HTML Web form.
Chart: Use a chart when you want to show data graphically.
Metric: Use a metric when you have one key value to display.
Enter metric labels directly on components by clicking the empty text field next to the grand total.
Metric components placed directly above and below each other in a dashboard column are displayed together as a single component.
Gauge: Use a gauge when you have a single value that you want to show within a range of custom values.

44. What is the maximum size of the PDF generated on visualforce attribute renderAs ?
Answer : 15 MB

45. What is the System.runAs() ?
Answer :
Generally, all Apex code runs in system mode, and the permissions and record sharing of the current user are not taken into account. The system method, System.runAs(), lets you write test methods that change user contexts to either an existing user or a new user. All of that user’s record sharing is then enforced. You can only use runAs in a test method. The original system context is started again after all runAs() test methods complete.
Example :
System.runAs(u) {
// The following code runs as user 'nitish'
System.debug('Current User: ' + UserInfo.getUserName());
System.debug('Current Profile: ' + UserInfo.getProfileId()); 
}
// Run some code that checks record sharing

46. What is Difference in render, rerender and renderas attributes of visualforce?
Answer :
render : It works like display property of CSS. It is used to show or hide element on visualforce page.
rerender : After Ajax which component should be refreshed – This attribute is available on commandlink, commandbutton, actionsupport .
renderas : render page as PDF, DOC and Excel. With the help of this attribute you can download the data display on visualforce page.

47. When Group By is used, How to write or use the Where clause in SOQL ?
Answer :
We cannot use the Where clause with Group By instead we will need to use the Having Clause.

48. If user does not have any right on particular record and have only read level access at object level. Can he change the record owner?
Answer :
Yes. In profile, there is setting for Transfer Record.

49. Explain the use of Test.setPage() ?
Answer :
It is used to set the context to current page, normally used for testing the visual force controller.

50. Can you use Group by clause inside inner query in SOQL? like SELECT Id, Name,(SELECT Count(Id),Name FROM Contacts Group By Name Having Count(Id) > 1 )
Answer :
No. Only root queries support aggregate expressions. Return type is List<AggregateResult> for above query However the root result expects List<Account> and there is no syntax or provision available in Salesforce to specify that child results are of type AggregateResult.

More Salesforce Interview Questions and Answers: