Followers

Salesforce Interview Questions : Part 3

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__cthen 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’);
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

No comments:

Post a Comment