Top 50 Salesforce Interview Questions
Q1. What Is The Difference Between Trigger And Workflow?
Trigger:
Trigger is a piece of code that executes earlier than or after a file is inserted or updated.
We can get admission to the trigger throughout the object and related to that items.
We can use 20 DML operations in one trigger.
We can use 20 SOQL from statistics base in one cause.
Workflow:
Workflow is computerized process that fired an movement primarily based on Evaluation standards and rule standards.
We can access a workflow across the item.
We can't perform DML operation on workflow.
We cannot question from database.
Q2. What Is Apex In Salesforce?
Apex is a strongly typed item-oriented programming language.
It permits the developer to execute flows and transaction control statements.
Apex permits builders to feature business good judgment to maximum device occasions like button clicks associated document updates and visualforce pages.
Q3. What Is The Usage Of Apex Program With Within Visual Force Page?
When you want to name apex class in visualforce page we must claim in the following format.
< Apex : page controller = “class name “ >
Whenever we call a visualforce page wherein controller characteristic is described it will first create an object for the apex elegance that is described in controller.
When item is created for the apex elegance first it involves the constructor.
Q4. Is The Check Box Performs Like Controlling Field?
Yes possible. Controlling discipline must be Check container or pick listing.
Q5. What Is A Time Trigger?
A putting that defines while time-established workflow movements ought to fire.
Q6. What Is App In Salesforce?
An app is a set of tabs that paintings as a unit to offer functionality. Users can transfer between apps the use of the Force.Com app drop-down menu on the pinnacle-right corner of each web page.
You can customise current apps to suit the way you figure or build new apps via grouping general and custom tabs.
Navigation to create an app in Salesforce: Setup ->Build ->Create->App-> Click on new and create your application in step with your necessities.
Q7. List Things That Can Be Customized On Page Layouts?
We can customise various things on web page layout like, Fields, Buttons, Custom Links and Related Lists. We can also create sections.
Q8. What Are Force Platform Sites?
Public websites and programs which are immediately included along with your salesforce agency with out requiring users to log in with a username and password.
Q9. What Is Tab In Salesforce?
Tab is a consumer interface factor to person creates to display custom item information.
There are 3 sort of tabs:
Custom Tabs
Visual force Tabs
Web Tabs
Q10. How To Add Javascript Remoting To A Vf Page?
To use javascript remoting in a vf web page , add the request as a java script invocation with the subsequent from.
[namespace.] controller.Approach (
[parameters….,]
Call lower back Function,
[configuration]
);
Name area is the namespace of the controller elegance
Controllers is the call of your apex controller.
Method is the name of your apex controller technique you are calling.
Parameters is the comma-separated list of parameters that your approach takes.
Callback characteristic is the call of the javascript function so as to handle the reaction from the controller.
Configuration configures the handling of far off call and reaction.
Q11. How Many Ways We Can Share A Record?
Role Hierarchy:
If we upload a consumer to a position, the consumer is above within the position hierarchy may have read get right of entry to.
Setup --> control users --> roles --> setup roles --> click on ‘add position’ --> provide name and store.
OWD:
Defines the bottom line setting for the enterprise.
Defines the level of access to the person can see the other consumer’s file
OWD may be Private, Public Read Only, Public Read and Write.
Setup -> Security Controls -> sharing settings -> Click on ‘Edit’
Manual Sharing:
Manual Sharing is sharing a unmarried document to single user or organization of users.
We can see this button detail page of the record and this is visible simplest while OWD setting is personal.
Criteria Based Sharing regulations:
If we need to share statistics based totally on situation like percentage records to a group of users
Whose standards are usa is India.
Setup -> protection controls -> sharing settings -> choose the object and offer name and Conditions and save
Apex sharing:
Share object is available for each object(For Account object proportion item is AccountShare ). If we need to share the statistics using apex we need to create a document to the proportion object.
Q12. What Are Record Types?
Record Types are restrict the pick listing values and assign to the unique web page layouts for distinctive Record Types.
Q13. What Are Some Apex Classes That Are Commonly Used Within Controller ?
Standard controller, select alternative, pagereference, messages,and many others.
Q14. How Many Ways We Can Call The Apex Class?
Visual force page
Web Service
Triggers
Email services
Q15. What Is Sharing Rule?
If we want to give access to other customers we use sharing rules.
Q16. Will Visualforce Still Supports The Merge Fields Usage Like S-control?
Yes. Just like S-Controls. Visualforce pages support embedded merge fields.
Q17. How To Invoke Batch Apex Job (or) How To Execute The Batch Apex Job Programatically?
We can use database.Executebatch ( ) approach to programmatically begin the batch task.
Syntax:
Public static ID execute batch ( sObject class name)
Public static ID execute batch (sObject class name, integes scope)
The above two methods are static strategies of database class. We can use anybody of the approach to execute the batch activity.
Q18. How Many Relationships Included In Sfdc & What Are They?
We are having forms of relationships, they're:
Lookup Relationship
Master-Detail Relationship
Q19. What Is Field Dependency?
According to the field selection on one area filter out the pick out list values on different field.
Q20. What Is Batch Apex In Salesforce?
Batch Apex:
Batch Apex allows you to outline a single job that can be broken up into doable chunks, whereas every bite can be processed one at a time.
Q21. What Is Group By?
With ApI version 18.Zero and later /you could use institution by way of with combination capabilities, along with sum() or max() to summarize the information and enable you to rollup question outcomes as opposed to having to procedure the character records to your code.
Syntax :
[ GROUP BY field GROUP BY LIST]
Q22. What Is Apex Programming Language?
Integrated: It affords built-in help for DML Calls
Inline Salesforce Object Query Language
Easy to Use
Easy to Test
Version
Multi Tenant Aware Application
Q23. When Should I Use Apex?
To create Email services
Create web services
Perform complicated validation over multiple objects
To create complicated commercial enterprise strategies that aren't supported by workflow
Create custom transaction common sense
Attach custom common sense to another operation
Q24. What Are Sosl Statements In Salesforce Apex?
SOSL declaration evaluate to a listing of sobjects , in which every listing contains the search effects for a selected sobject type, The end result lists are usually returned within the equal order as they have been specified in the question.
If a SOSL query does now not return any statistics for a targeted sObject kind , the hunt results encompass an empty list for that sObject.
For example, you could return a listing of accounts, contacts, opportunities and leds that start with the segment map.
Note :
The syntax of the classon Apex differs from the syntax of the FIND clause in the SOAP API.
In Apex, the cost of the FIND purpose is demarcated with unmarried quotes.
Example:1
FIND 'map*' IN ALL FIELDS RETURNING account (Id, Name], Contact, Opportunity, Lead.
In the Force.Com API, the value of the FIND Clause is demarcated with braces.
Example:2
FIND map* IN ALL FIELDS RETURNING account [Id,name], contact ,opportunity,lead.
From search list , you can create arrays for each object back.
Account [ ] debts = (( listing < accounts > ) search listing [0] );
Contact [ ] contacts = [( listing ) search list [0]) ;
Opportunity [ ] opportunities = ((list < opportunity> ) seek list [2]) ;
Lead [ ] leads = (( listing < lead> ) search listing [3]);
Q25. What Is Soap?
A protocol that defines a uniform way of passing XML-encoded information. SOAP Stands for Simple Object Access Protocol.
Q26. What Is Wrapper Class?
A Wrapper magnificence is a category whose instances are collection of different objects.
It is used to show special objects on a VF (Visual Force) page in identical desk.
Q27. What Is The Difference Between Action Support And Action Function?
Action characteristic:
Invoke the controller method from java script the usage of AJAX and we are able to use action characteristic from one of a kind locations on visual force web page.
Action assist:
Invoke the controller technique using AJAX while even happens on page like onMouseOver, onClick, ect… and we will use action support for unique single apex element.
Q28. What Is The Main Difference Between Using Data Table Vs Page Block Table Tags?
Page Block:
For default salesforce fashionable format.
Data table:
To layout custom codecs.
Q29. Why Use Batch Apex?
A Batch magnificence lets in you to define a unmarried job that may be damaged up into manageable chunks in an effort to be processed one after the other.
One instance is if you need to make a area update to each Account for your enterprise. If you've got 10,001 Account facts on your org, this is impossible without a few manner of breaking it up. So in the begin() technique, you outline the question you’re going to use in this batch context: ‘pick Id from Account’. Then the execute() method runs, however only gets a fantastically short list of facts (default 2 hundred). Within the execute(), the entirety runs in its own transactional context, which means that almost all the governor limits handiest apply to that block. Thus each time execute() is run, you are allowed a hundred and fifty queries and 50,000 DML rows and so forth. When that execute() is complete, a new one is instantiated with the following institution of two hundred Accounts, with a latest set of governor limits. Finally the end() technique wraps up any unfastened ends as essential, like sending a status email.
So your batch that runs against 10,000 Accounts will certainly be run in 50 separate execute() transactions, every of which only has to deal with two hundred Accounts. Governor limits still follow, but handiest to each transaction, along with a separate set of limits for the batch as an entire.
Disadvantages of batch processing:
It runs asynchronously, which can make it difficult to troubleshoot without a few coded debugging, logging, and chronic stateful reporting. It also way that it’s queued to run, which can also reason delays in beginning.
There’s a restrict of 5 batches in play at any time, which makes it elaborate to start batches from triggers until you are checking limits.
If you want access within execute() to a few massive a part of the full dataset being iterated, this isn't to be had. Each execution best has get right of entry to to whatever is handed to it, despite the fact that you can persist elegance variables with the aid of enforcing Database.Stateful.
There remains a (pretty big) restrict on overall Heap length for the whole batch run, this means that that some very complicated common sense might also run over, and want to be broken into separate batches.
Q30. Can We Create Master-element Relationship In This Case?
No, at once we can't create grasp-details courting if a custom item incorporates present facts.
Following are the stairs to create to create a grasp-detail courting while records are available in a custom object.
First create field with research dating.
And then accomplice look area with parent record for every record next change the information type of the sector from appearance as much as Master element.
Q31. What Is Apex Email Service?
Email offerings is an automatic technique that use Apex training to method the contents, Headers, Attachments of Inbound Email.
Q32. Can Call Apex Class Method On The Fly (dynamically)?
While you could instantiate a class based totally on its name using the Type machine class, you can’t dynamically find a way and execute it. The nice that you may do is to dynamically create an instance of a class that implements an interface and executes one of the techniques at the interface.
Q33. What Is App Exchange Directory?
A net directory wherein hundreds of appexchange apps are to be had to salesforce customers to study, demo, comment upon, and /or installation. Developers can post their apps for listing at the appexchange listing if they want to percentage them with the community.
Q34. What Is Map Class In Apex Salesforce?
Map Class Contains strategies for the Map collection type.
A Map is collection of key values pairs in which each particular key maps to a unmarried fee.
Map keys and values can be any statistics type primitive types, collections, sObjects, users defined sorts, and built in Apex Types.
Q35. What Is Metadata Driven Development Model?
An app improvement version that lets in apps to be described as declarative "blueprints”, with no code required. Data Models, gadgets, paperwork, workflows, and greater are defined with the aid of Metadata.
Q36. What Is Javascript Remoting For Apex Controllers?
Use javascript remoting in visualforce to name techniques in apex controllers from javascript.
Javascript remoting has 3 components.
The remote method invocation you add to the visualforce web page, written in javascript.
The far flung approach definition in your Apex controller magnificence.
This approach definition is written in apex, however there are few variations from everyday movement techniques.
The response handles callback characteristic you upload to or include to your vf web page, written in javascript.
Q37. Is There A Defector 3rd Party Utilities Library For Apex Such As Apache Commons Is For Java?
Apex-lang is ready as near a Java-style library as you can get. Contains several string, database, and series utilities that mimmick Java functionality. Be aware though, a few stuff including Comparing and Sorting collections is obsolete with the advent of the Comparable interface in Apex.In addition to apex-lang, and like you suggest, I usually create or reuse static helper strategies all through my projects. Static helper strategies are very handy for reusing code in Chatter capability, DML dealing with, Exception managing, Unit trying out, and so forth.
Q38. What Is Future Annotation(
Use the destiny annotation to specify that these strategies which are completed asynchronously.
Methods with future annotation need to be static techniques
Methods with destiny annotation can simplest return a void kind.
Syntax:
international elegance class_name
@future
Static void methodname(parameters)
//body of the method
Q39. How To Unit Test Code Which Has Logic Around The Created Date?
You can create sObjects in memory with arbitrary CreatedDate values via using JSON.Deserialize. This doesn’t put in force the everyday read-handiest subject attributes that prevent you from setting a createdDate cost. However, you may’t commit arbitrary CreatedDate values to the database (or else it might be a severe security difficulty).
Detecting governor limits thru apex
First of all, the exception thrown by way of hitting a restrict, System.LimitException is uncatchable and means that your script could be killed, even though it happens inside a try/trap block. There is a category, Limits, that contains some of static techniques that permit you to test your governor restrict consumption.
Q40. Does User Can Create Insert Their Own Custom Logo, While Creating Their Own Custom Applications?
Yes,user can add their custom brand in documents after which they select that emblem for enterprise.
Q41. What Is The Object In Salesforce.Com?
Objects are database tables that allow you to store information unique to your company in salesforce. You can use custom items to extend salesforce.Com capability or to build new software capability.
When you create a custom object, we are able to create a custom tab, customized associated lists, reports, and dashboards for customers to engage with the object data. You also can get admission to custom item records via the Force.Com API.
Navigation to create an item in income force: Setup-->Build-->Create-->Object--> Click on new item and create item in line with your requirement.
Q42. How Does Apex Work?
All Apex applications runs absolutely ON-Demand on Force.Com Platform.
First the platform software server compiles the code into abstract set of instructions that may be understood by Apex runtime interpreter.
The compile code is stored to metadata.
When the end users triggers the execution of Apex with the aid of clicking button or visualforce page the software servers retrieves the compiled commands from the metadata and ship them to runtime interpreter before returning the end result.
Q43. What Are Report Types?
There are 4 varieties of reports in Salesforce:
Tabular Reports
Summary Reports
Matrix Reports
Joined Reports
Q44. What Is S-manipulate?
S-Controls are the important salesforce.Com widgets which can be completely based on JavaScript. These are hosted via salesforce however executed at customer aspect. S-Controls are outdated with the aid of VisualForce now.
Q45. What Are The Types Of Soql Statements In Sales Force?
Salesforce Object Query Language is used to question that data from the database.Com based totally on the requirement.
There are 2 sorts of SOQL Statements:
Static SOQL
Dynamic SOQL
1.Static SOQL:
The oStatic SOQL Statement is written in [] (Array Brackets)
This statements are similar to IINQ(Ion Integrated Query)
2.Dynamic SOQL:
It is used to consult the creation of a SOQL string at run time with Apex code.
Dynamic SOQL enables you to create more flexible utility.
To create Dynamic SOQL query at run time use Database.Query() technique, in one of the following methods.
Return a unmarried sObjects when the question returns a single document. Ex:sObjects s = Database. Query(String_limit_l);
Return a listing of sObjects while the question returns greater than a unmarried record.
Q46. What Is Multi Tenant Architecture?
An software model wherein all customers and apps proportion a single, Common infrastructure and code base.
Q47. Is There A Way To Setup Continuous Integration For Apex Tests?
There are more than one decent Dreamforce shows here:
Team Development:
Possible, Probable, and Painless and Continuous Integration within the Cloud.
We bumped into a few problems with this in practice and there was no manner to get authentic automation (i.E., set it and overlook it). We were also set it up with Selenium.
Here were the problems that I take into account:
Some functions aren’t supported in the metadata API and can't be moved via the ant migration. If you have got any unit assessments that work with the ones features, you need to manually work to your CI org.
Deletions are more difficult to hold. You have to manually update and observe a destructiveChanges.Xml report or mirror the deletion within the CI org.
We ran into a situation in which some metadata XML files had ‘invalid’ facts in them. The advised solution became to construct a publish checkout script that manipulates the offending XMLs into valid XMLs. Not perfect.
On projects, we wanted to song simply our adjustments and push out simply our adjustments in supply manipulate. In principle, this will permit a good deal easier rebase lining. This might have required extra guide renovation of XML documents (e.G., 2 new fields introduced on Account and only need to push the ones 2 fields no longer all (*) fields).
My end is that it is worth doing if you could get it set up, however if you are running on shorter-time period initiatives and don’t have a decent amount of time budgeted in for it, it likely isn’t well worth putting in.
Q48. Difference Between Soql Vs Sosl In Salesforce?
SOQL:(Salesforce Object Query Language)
Using SOQL we can Search best on one object one time.
We can query on all fields of any datatype
We can use SOQL inside the Triggers and the classes.
We can perform DML operation on sq. Query effects.
SOSL:(Salesforce item Search Language)
Using SOSL we are able to search on many gadgets at one time.
We can query simplest on fields whose information kind is textual content,telephone and Email.
We cannot use in Triggers however can in training.
We can't perform DML operation on seek results.
Q49. What Are The Effects Of Using The Transient Keyword?
The temporary keyword prevents the statistics from being saved in to view country. This should be used for extremely brief variables.
Q50. What Is Apex Scheduler?
It will invokes the Apex magnificence to run at unique time.
Anybody who need to schedule their magnificence they must enforce schedulable interface.
Schedule Interface:
The elegance that implements this interface may be scheduled to run at exclusive durations. This interface has numerous methods.
They are:
Public void execute(schedulablecontext sc) etc.
