Salesforce Admin Interview Questions and Answers

Interview Questions – SalesForce(SF) Admin:

SF Basics:
What is Cloud computing? Cloud computing is shared pools of configurable computer system resources and higher-level services that can be rapidly provisioned with minimal management effort, often over the Internet. Cloud computing relies on sharing of resources to achieve coherence and economies of scale, similar to a public utility.
What is CRM? CRM is “Customer Relationship Management “. We can understand from the full form where CRM is an application used to automate Sales and marketing functions by a using a Software called CRM Software . BY using CRM Software every Company / Organization plans to increase their revenues and profits. This strategy of increasing revenue is done mainly by attracting Customers, clients, Sales etc.
What are the Advantages of Cloud Computing? Cloud computing has made tremendous growth in processing power, reliability of the Internet and the great increase in broadband speeds. It makes tremendous sense to make use of the centralized server of the provider of cloud computing services as not only does it reduce the costs by a great extent by making redundant the need to buy several software licenses, it also eliminates the huge costs required by an organization to maintain and upgrade existing software.
What are deployment modes of cloud computing? Cloud computing services can be provided in four different deployment modes depending on size and structure of an organization. Four deployment modes of cloud computing are Public Cloud. Private Cloud. Hybrid Cloud and Community Cloud.
What is PaaS? PaaS means” Platform as a Service”. Here in “PaaS “ the cloud service providers provides hardware, OS(operating System), Storage, Network services over the cloud. It is the way like a rent. If there is no service like Platform and there will be no Applications. Which applications are build on a Platform
What is SaaS? SaaS means Software as a Service. Through this Services all the software’s are distributes over the cloud. By using SaaS no need to install any software all software’s are readily available over the internet .
What is IaaS? Full form IaaS is “Infrastructure as a Service”. Here in IaaS the cloud service providers will provides infrastructure like servers, hosting services and storage. Servers and storage’s are the basic services provide by Cloud Service Providers.
What is Public Cloud? Public clouds are the most common way of deploying cloud computing. The cloud resources (like servers and storage) are owned and operated by a third-party cloud service provider and delivered over the Internet. Examples: Azure, AWS Advantages of public clouds: Lower costs—no need to purchase hardware or software, and you pay only for the service you use. No maintenance—your service provider provides the maintenance. Near-unlimited scalability—on-demand resources are available to meet your business needs. High reliability—a vast network of servers ensures against failure.
What is Private Cloud? A private cloud consists of computing resources used exclusively by one business or organization. The private cloud can be physically located at your organization’s on-site datacenter, or it can be hosted by a third-party service provider. But in a private cloud, the services and infrastructure are always maintained on a private network and the hardware and software are dedicated solely to your organization. Advantages of a private clouds: More flexibility—your organization can customize its cloud environment to meet specific business needs. Improved security—resources are not shared with others, so higher levels of control and security are possible. High scalability—private clouds still afford the scalability and efficiency of a public cloud.
What is Hybrid Cloud? Often called “the best of both worlds,” hybrid clouds combine on-premises infrastructure, or private clouds, with public clouds so organizations can reap the advantages of both. In a hybrid cloud, data and applications can move between private and public clouds for greater flexibility and more deployment options. For instance, you can use the public cloud for high-volume, lower-security needs such as web-based email, and the private cloud (or other on-premises infrastructure) for sensitive, business-critical operations like financial reporting. In a hybrid cloud, “cloud bursting” is also an option. Advantages of hybrid clouds: Control—your organization can maintain a private infrastructure for sensitive assets. Flexibility—you can take advantage of additional resources in the public cloud when you need them. Cost-effectiveness—with the ability to scale to the public cloud, you pay for extra computing power only when needed. Ease—transitioning to the cloud doesn’t have to be overwhelming because you can migrate gradually—phasing in workloads over time.
What are the different types of Cloud Service providers? is based on which cloud ? is based on Software as a Service ( SaaS).
What are common factors on SaaS, PaaS, and IaaS? SaaS Google Apps, Dropbox, Salesforce, Cisco WebEx, Concur, GoToMeeting PaaS AWS Elastic Beanstalk, Windows Azure, Heroku,, Google App Engine, Apache Stratos, OpenShift IaaS DigitalOcean, Linode, Rackspace, Amazon Web Services (AWS), Cisco Metapod, Microsoft Azure, Google Compute Engine (GCE)
What is Salesforce? Salesforce is one of the best customer relationship management (CRM) tool. Salesforce is among one of the best web based flexible and powerful database provider available in the market.
Different Salesforce Editions? provides different types of editions and features depending upon the cloud. For Sales cloud it provides four different types of editions. They are Group. Professional. Enterprise. Unlimited.
Number of Salesforce Editions released per year? Salesforce Releases e updates for every year. They are Spring. Summer. Winter.
Difference between and and are relatively same but they are different in their functionality. is used to develop CRM functionality based application where is used to customize our data model, business logic and User interface
What is is a type of service provided by to enhance the power of CRM applications. provides “Data as a Service” to subscribers.
How many types of portals are available in Salesforce? In we have three types of portals. They are Customer Portal. Partner portal. Self Service portal.
What is App in Sales force? App means an Application. In Salesforce an Application consists a group of tabs which are designed to work as a single function. We have number of applications in some of them are sales, marketing, chatter,, etc.
Different types of object in And why they called so? In we have two types of objects: Standard Objects :- Standard objects are called so because they are created and provided by Custom Objects :- Custom objects are those which are created by an User in
What is an object in Sales force? An Objects is represented as a database table which stores organization data . Objects consists of set of fields and we store data against that field. To view data Salesforce provided TABS.
What is TAB in Salesforce? provides list of tabs and are placed in Tab menu. To access data of an objects Tabs are used. Tabs in Salesforce are three types: Custom Tabs. Visualforce Tabs. Web Tabs.
List examples of custom field types? Some of the custom field types are date field, Date/Time field, Currency field, Checkbox field, Number field, Text field, Pick list field, Email field, percent fields, phone field, Url field and many more.
What are the Standard and Custom Fields in Salesforce? Standard fields for custom objects stores the information about created by, modified by, currency, Name, owner and Division. These are the standard fields in Custom field for custom objects store unique data or information of an organization.
How many custom fields can an object have? Unlimited edition can have up to 500 fields per object. Professional edition can create up to 100 custom fields per objects.
What is a profile? Profiles are those which defines user’s to perform different functions like settings and permissions in salesforce. It is another way to restrict or control access to a particular record. Profile are of two types. Standard Profile. Custom Profile. Standard Profile : Profiles created by are called Standard Profiles. Custom Profiles :Profiles created by user are called Custom Profiles.
What is a Role? Roles :- Using we can provide record level access like organization wide defaults, Role hierarchy, sharing rules and Manual sharing. Simply roles influences record level access.
Number of standard profiles available in In salesforce we have 6 standard profile they are. Standard user. Solution manager. Marketing User. Read only. System administrator.
How can you use the term “Transfer Record” in profile? Transfer record is a type of permission in salesforce. If a user is is given access to transfer a record then the user will have the ability to transfer the records which have Read access.
Define Company Profile? In company profile consists of information about language, locale, time zone, number of licenses, storage and available space, about fiscal year, address and currencies.
How to get security token in To get security token in go to yourname=>Personal=>Reset my Security token.
What is a Fiscal Year in Salesforce? Fiscal years in Salesforce are used to define starting and ending date of an organization financial year.Fiscal years in salesforce are two types they are. Standard fiscal year :- To change starting month of the fiscal year this type is used. Custom fiscal year :- We can set custom fiscal year dates like quarters, weeks.
What is a dependent pick list? Dependent Picklist allows to contain multiple values and pick value one among them or Multiple values among them. Dependent fields depends upon controlling field.
What is Page Layout and Record Types? Page Layout :- In page layout customization can be done like fields, related lists, custom links can be arranged. Record Types :- Record types in salesforce helps to implement business processes like defining picklist values for standard and custom pick lists.
How to delete user from Salesforce? n, deleting a user is not possible. But the user can be deactivated by freezing that user in salesforce. To deactivate user go to Setup=>Administer=>Manage users=>Users=>Freeze
In how many ways can we store files, images and documents in what are they? In we can store files, images and documents in 5 types they are. Attachments. Documents. Google drive. Libraries. Chatter Files
What are Static Resources? Static resources helps to store upload images, files, zip files, documents, javascript files, Css Files which can be used in visualforce pages. Maximum data storage limit for static resource is 250mb.
List some standard indexed fields in Id, name, owner fields, lookup fields, master-detail relationship fields, audit dates like Last Modified dates etc are the standard indexed fields in
Which fields are Indexed by default in Salesforce? Salesforce indexed some fields by default they are Id, name, owner fields, lookup fields, master-detail relationship fields, audit dates like Last Modified dates.
Which fields cannot be added as a custom Index? Formula fields.
Is it possible to edit formula field values in a record? No
In salesforce, Can two users’ can have same profile? Yes
SF Security:
What is a Sharing Rule? Sharing rules in Salesforce represent the permissions and exceptions to your organization. By using sharing rules we can grant access to edit, read, read/write permissions to user. Sharing Rules are of two types: Manual Sharing. Automatic Sharing.
What is Manual Sharing? Manual sharing is the process of sharing records manually.
What is permission set? Permission sets in are the combination of different settings and permission sets given to user to access records and files. Note :- Manual sharing is available for only Organization wide default settings are private to the object.
Difference between profiles and permission sets? Permission Sets : In this Permission sets we define the access level of the user. Generally we determine what a user can do in the applications. These are used to grant additional permission to a user. Profiles : In Object level Security, Profiles are assigned to the user by system administrator. A profile can be assigned to many users where as a user can have only one Profile.
How can you define Field Dependency? In Field dependency, we have to fields controlling filed and dependent field. When a selection is made the controlling field controls dependent picklist values. Ex:- When a country is selected in dependent picklist then the states are available to that country. Here country is controlling field and State is dependent field.
How many field dependencies we can use in Visual Force page? We can use up to 10 field dependencies in visualforce pages
Tell me about Field-Level Security? In field level security, we control the user what to see, edit, delete of a particular field in the object
Briefly describe about Field-Level Security? In field level security, we control the user what to see, edit, delete of a particular field in the object. In some situation like if we want to grant access control over Object to a user but the user should not be able to access some particular fields in that objects then we go for Field Level Security. Field Level Security can be controlled by Profiles and Permission sets. = > Profiles. Page Layouts. IP Ranges. Login Hours. Desktop. Client Access. = > Permission sets. App Permissions. Record Types. Tab Settings. Assigned Apps. Object Permissions. Field Level Security. Apex Classes Visual Force Pages
What are Login Hours and Login IP Ranges? Login hours are set in an organization to restrict the user’s who tries to login before or after login hours. To set login hours in an organization go to Setup=>Administration=>Manage users=>Profiles. IP ranges are used to restrict any login attempt is done from unknown IP addresses. Usually organizations maintain login IP ranges. To set Login IP ranges in salesforce go to Setup=>Administration Setup=>Manage Users=> Profiles.
What is a User Record? User records consist key information about the user
What is a Record Owner? Record Ownership : The User or Queue who controls and have the right to access a record. Generally there are two types of Owners: Users. Queues.
What are Organization Wide Defaults? Organization wide Defaults define the baseline level of access to data records for all users in an Organization. Organization wide Defaults are used to restrict access to data(Records). Organization wide Defaults(OWD) can be defined for Standard Objects and Custom Objects.
What is a Role and Role Hierarchy? Salesforce uses role hierarchy to automatically to grant access to users by default. We can not edit Grant Access using Hierarchies for standard objects and can edit Grant Access using Hierarchies check box for Standard objects.
What is Access at the Role Level? Access at the role level depends upon the organization wide defaults.
What are the different types of Sharing Rules in Salesforce and explain them? Account sharing Rule. Contact Sharing Rule. Case Sharing Rule. Opportunity sharing Rule. Lead Sharing Rule. Custom Object sharing Rule.
In how many ways can we share a record? Records can be shared in 5 types they are Role Hierarchy. Organization Wide Defaults. Manual Sharing. Criteria Based Sharing Rules. Apex Sharing.
Best Practices of Creating Contact Sharing Rules? Organization wide default settings are used to set red, write, read/write permissions
How can i provide record level access to user’s in an organisation? then what should i use from Salesforce security model? After setting Object and Field Level Security the situation may arise like if a user is eligible to access a particular Record in a Object there we use this sharing method . This can be done by the following settings. Org Wide Defaults. Role Hierarchy. Sharing Rules. Manual Sharing. Criteria Based sharing
If i want Object level accesses then what should i use from Salesforce security model?
In Partner Community, external user is having appropriate OWD and Profile Settings for Opportunity or consider any other Object. However they are getting insufficient privilege access, what might be cause of this error ?
What are governor limits? Governor Limits in are the run time limits enforced by the apex runtime engine to write scalable and efficient code.
Is it possible to bypass Grant Login access using Hierarchies in case of standard objects? Yes
Can we use sharing rules to restrict data access? No, sharing rules cannot restrict data access.
Is it possible to create sharing rules for detail object? No, we can create sharing rules for details objects because they don’t have owner field.
SF Organization wide Defaults(OWD):
How can you change the setting “Grant Access Using Hierarchies” for Standard Objects ?
What are the Mandatory points that you think while creating User, Role or Profile?
While setting OWD (Organization wide sharing), can we change/modify the setting of child record in case of Master-Detail relationship?
While setting OWD (Organization wide sharing), can we change/modify the setting of child record in case of Master-Detail relationship?
Number of accesses available in Organization Wide Defaults and what are they?
n Partner Community, external user is having appropriate OWD and Profile Settings for Opportunity or consider any other Object. However they are getting insufficient privilege access, what might be cause of this error ?
SF Relationships:
What are the different types of Relationships in SFDC?What are they?
What is a “Lookup Relationship”?
What is “Master-Detail Relationship”?
What is a “Self Relationship”?
What is Roll-up summary?
How to create Roll-up summary field on lookup relationship?
Can we have Roll up Summary fields in case of Parent-Child Relationships?
Is it possible to edit Roll up summary field value in a record?
Can we create Roll up summary field on parent object ?
How to create Many – to – Many relationship?
What is Junction Object?
What are the main things need to consider in the “Master-Detail Relationship”?
Can we convert the look up relationship to Master Detail relationship? If so How can we convert?
Can we create Master Detail relationship on existing records?
How to create many to many relationships between two objects?
In case of Master-Detail relationship, on Update of master record can we update the field of child record using workflow rule?
In case of Master-Detail relationship, on Update of child record can we update the field of Parent record using workflow rule?How to move Relationships to production from Full Sandbox?
What happens to detail record when master record is deleted?
What happens to child record when a master record is deleted in Lookup Relationship?
A custom object contains some records, now my requirement is to create field in this object with master detail relationship.
Can we create master detail relationship in this case?
In case of Master-Detail relationship, on Update of master record can we update the field of child record using workflow rule?
SF Reports and Dashboards:
What are different kinds of reports?
What are Standard Reports?
What are custom Reports?
What is a Tabular report ?
What is a Summary Report?
What is a Matrix Report?
What is Trend Report?
What are Custom Report Types?
Who can run Reports?
What is a bucket field in reports?
Is it possible to delete reports using Apex?
What are Dashboards?
Dashboard Components?
What are dynamic Dashboards?
Can we schedule dynamic dashboards?
Explain dynamic Dashboard.
Who can access “drag and drop dashboard”?Which type of report can be used for dashboard components?
Which permission is required to set the running user other than you in dashboard?What is the use of “floating report header”?
How to enable “floating report header”?
What is Analytical Snapshot in
SF Workflows and Approvals:
What is Workflow?
Different Workflow Components available in salesforce?
What are the different workflow actions available in Salesforce?
What is a Workflow Rule?
What is a Workflow Task?
What is a Workflow Alert?
What is a Workflow Field Update?
What is Time-Dependent Workflow?
Working with Time-Dependent workflow?
Time-Dependent Workflow – Considerations?
Limitations of Time-dependent workflow?
In which criteria of a workflow – “time dependent workflow action” cannot be created ?
When you can’t add Time dependent action in Workflow rule?
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?
We have “Time Based Workflow” and there is action scheduled to be executed. Can we delete that workflow?
How to clear the Time based workflow action queue?
While creating workflow on Task, what difference observed on available actions?
For which criteria in Workflow “Time dependent workflow action” cannot be created?
Suppose if a record meets workflow criteria for time based workflow action, the action goes in queue. Later, before the time based action is triggered, the same record gets modified and the criteria previously met is changed and now it does not meet the workflow criteria. What happens to the time based action placed in Queue?
Difference between Trigger and Workflow?
SF Data Loaders:
Briefly describe about Data Loader?
What are the different actions that can be made using data loaders?
How can we insert a record using Data Loader?
How to delete a record using Data loader?
How to update a record using Data Loader?
How to export records from Salesforce using Data Loader?
Explain about UPSERT?
How to handle comma fields while uploading using Data loader?
After Exporting data using Data Loader, Some time it appears that data is on New Line (Carriage Return) when we open CSV file in Microsoft Excel. For example, Address Data separated on different lines. How can we override this problem?
Explain me about Export and Export all in Data Loader?

Salesforce Apex Interview Questions and Answers

What is APEX and what is it used for? APEX is an object-oriented programming language and is a proprietary language by Salesforce. It is strongly typed language and is the to develop the products in Salesforce to perform transaction control statements and flow execution operations. The APEX’s syntax is similar to Java and can be used in web service requests.
What is Lightening Framework Lightning” is a larger (marketing) effort to rebrand existing and new Salesforce1 platform services under one shiny new umbrella. “Salesforce1 Lightning” consists of the following pieces, among others: Lightning Schema Builder (rebrand of Schema Builder) Lightning Process Builder (rebrand of Visual Workflow) Lightning Components (new – port of open source Aura Framework onto Salesforce1 platform) Lightning App Builder (new – drag and drop assembly of Lightning Components into a page) Lightning Connect (rebrand of “External Data Objects”, which allows you to interact with external data sources that implement the OData spec as if they were regular Salesforce SObjects )
What are the features of APEX? The different features of APEX are strong and strict data integration to perform the execution of multiple queries and statements concurrently, strongly typed which directly refers the object schema to provide the value, easy to use syntax which was derived from the java kind of programming language, easy testing which will provide easier execution and test suite creation.
What are the applications of APEX? The different types of applications of APEX are to create different types of services such as email, schedules, triggering etc., creating different web services with integration of multiple systems and different services, performing validations on multiple schema objects and customized validation rules, creating customized business processes for the unavailable features.
What is the architecture of APEX? The architecture of the APEX will involve an application server, data storage where the network will be connected to the internet and the end users and developer users will be involving in the different web server requests and compilation errors and validations. The platform application server compiles the source code into a sequence of instructions and will be interpreted by Apex interpreter. The execution of the triggers will be done by the end users. There will be no delay in the web service request to the application server platform.
What is APEX syntax? APEX syntax has different features such as variable declaration to store the different values in the memory. The queries will be like SOQL which will be used to execute the queries, loop statements to perform the iterations in performing the operations, flow control statements can be used to control the flow execution whether to start or stop the execution process, DML statements can be used to manipulate the data by executing the queries.
What does the APEX development environment contain? The Salesforce APEX development environment has different features and processes to be followed in order to successfully develop an application and also to set up and edition as per the requirement of the entity. The code can be developed either in a local developer edition or a sandbox of Salesforce. As per the standards, the code will usually be developed in Sandbox and will be deployed into production. The different operations those will be performed during the development of the code is developing the code and its compilation process, debugging the code, testing the code and application, performing the SOQL query execution and its efficiency, color coding, auto alignment and auto-completion of the build process. The main step of executing the code in Salesforce will include the login action into Salesforce sandbox or console before performing these operations.
What are the different data types in APEX? The different types of data types available in APEX language are Primitive Data Type (Integer, Long, Double, Date, DateTime, ID, or Boolean and String), Collections (Lists, Maps, and Sets) and Enum Classes, Interfaces and Objects. The Primitive data type Integer can be any value of a 32-bit number and will have some range similar to that of Java programming language. A Boolean data type will have a true and false value. The Date data type can only store the date value but not the time. The Primitive data type Long can be any value of a 64-bit number and will have some range similar to that of Java programming language. The String data type is a set of characters that will be initialized within single quotes. The data type Blob also exists which stores a binary set of data. Enum is an abstract kind of data type.
What are the different Collections in APEX? The different collection data structures in APEX are Lists, Maps, and Sets. A List can have any type of data stored in it such as primitives, collections, different types of complex objects or schema objects. There will be different types of methods available in the lists to perform different operations such as to retrieve the size of the list, to clear the contents, to get the details of the list and to update, delete and add the records or values into it. The same functionalities do also exist for Set and Maps but with different functionalities.
What is SOQL in APEX? This is the advanced APEX Interview Questions asked in an interview. SOQL is often called as Salesforce Object Query Language which was designed and developed to work with Salesforce Database.
What are the Security features in APEX? The different security rules in APEX are enforced while sharing the data or while running the code to protect the application features and code. There are different sharing security features also to be enforced and different levels of security.
Onchange Event Does Not Work With In Ie9. How To Resolve This Error? If we add the Header on Visualforce page then it creates lots of problem in IE9. I think there are few java-script library loaded by Header of Salesforce which makes IE9 compatible. So the best solution is to enable the Header by using “showHeader=true” in Apex page.
If Ie9 Is Not Working With Your Custom Visualforce Page Then How To Tell Your Visualforce Code To Run In Ie8 Compatibility Mode? Add metatag to pages: Apexpages.currentPage().getHeaders().put(‘X-UA-Compatible’, ‘IE=8’);
How To Display The Formatted Number / Date In Visual Force? Which Component Should Be Used? Format the number into currency. OR
You Want To Display The Encrypted Field On Visualforce And You Are Using Component Apex:outputtext. Will It Work For Encrypted Fields? Encrypted custom fields that are embedded in the component display in clear text. The component doesn’t respect the View Encrypted Data permission for users. To prevent showing sensitive information to unauthorized users, use the tag instead
Explain Difference In Count() And Count(fieldname) In Soql.? COUNT() must be the only element in the SELECT list. You can use COUNT() with a LIMIT clause. You can’t use COUNT() with an ORDER BY clause. Use COUNT(fieldName) instead. You can’t use COUNT() with a GROUP BY clause for API version 19.0 and later. Use COUNT(fieldName) instead. COUNT(fieldName) You can use COUNT(fieldName) with an ORDER BY clause. You can use COUNT(fieldName) with a GROUP BY clause for API version 19.0 and later.
How To Write The “where” Clause In Soql When Group By Is Used? We cannot use the “Where” clause with Group By instead we will need to use the “Having Clause“. Get all the opportunity where more than one record exists with same name and name contains “ABC”. SELECT COUNT(Id) , Name FROM Opportunity GROUP BY Name Having COUNT(Id) > 1 AND Name like ‘%ABC%’
Let’s Consider That The First Component In Vf Page Is The Datepicker. In That Case Whenever The Page Loads, Salesforce Auto Focus The First Component Resulting In Datepicker Onfocus Event. Because Of This The Datepicker Component Opens Automatically. How We Can Avoid This? On load event, write the javascript code to autofocus any other field or any other non-visible component. Example : window.onload=function() { document.getElementById(‘focusDistraction’).focus(); }
How To Force Lead Assignment Rule Via Apex While Updating Or Adding The Lead? 1. Instantiate the “Database.DMLOptions” class. 2. Set the “useDefaultRule” property of “assignmentRuleHeader” to True. 3. Finally call a native method on your Lead called “setOptions”, with the Database.DMLOptions instance as the argument. // to turn ON the Assignment Rules in Apex Database.DMLOptions dmlOptn = new Database.DMLOptions(); dmlOptn.assignmentRuleHeader.useDefaultRule = true; leadObj.setOptions(dmlOptn);
Access Custom Controller-defined Enum In Custom Component? We cannot reference the enum directly since the enum itself is not visible to the page and you can’t make it a property. Example: global with sharing class My_Controller { public Case currCase {get; set; } public enum StatusValue {RED, YELLOW, GREEN} public StatusValues getColorStatus() { return StatusValue.RED; //demo code – just return red } } Visualforce page: Above code snippet will throw error something like “Save Error: Unknown property‘My_Controller.statusValue’” Resolution: Add below method in Apex Controller: public String currentStatusValue { get{ return getColorStatus().name(); }} and change Visualforce code to
What Is The Need Of “custom Controller” In Visualforce As Everything Can Be Done By The Combination Of Standard Controller + Extension Class.? Sharing setting is applied on standard object/extension by default; In case we don’t want to apply sharing setting in our code then Custom controller is only option. It is possible that the functionality of page does not required any Standard object or may require more than one standard object, then in that case Custom controller is required.
In Class Declaration If We Don’t Write Keyword “with Sharing” Then It Runs In System Mode Then Why Keyword “without Sharing” Is Introduced In Apex? Let’s take example, there is classA declared using “with sharing” and it calls classB method. classB is not declared with any keyword then by default “with sharing” will be applied to that class because originating call is done through classA. To avoid this we have to explicitly define classB with keyword “without sharing”.
If User Doesn’t Have Any Right On Particular Record And Have Only Read Level Access At Object Level. Can He Change The Record Owner? Yes. In profile, there is setting for “Transfer Record”.
In Which Scenario Share Object “mycustomobject__share” Is Not Available/created For Custom Object “mycustomobject” ? The object’s organization-wide default access level must not be set to the most permissive access level. For custom Objects, that is Public Read/Write.
Using Dynamic apex, we can achieve this. On object of type pickilist, call getDescribe(). Then call the getPicklistValues() method. Iterate over result and create a list. Bind it to .
What Are The Types Of Controller In Visualforce? Standard Controller Custom Controller
How Many Controllers Can Be Used On Single Vf Page? Only one controller can be used salesforce. Other than them, Controller extension can be used. There may be more than one Controller extension.
Explain System.runas()? 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
Explain Test.setpage(). It is used to set the context to current page, normally used for testing the visual force controller.
How To Round The Double To Two Decimal Places In Apex? Decimal d = 100/3; Double ans = d.setScale(2);
In How Many Ways We Can Invoke The Apex Class? 4 ways: 1. Visualforce page 2. Trigger 3. Web Services 4. Email Services
Can We Create Master Detail Relationship On Existing Records? No. First we have to create the lookup relationship then populate the value on all existing record and then convert it.
How Validation Rules Executed? Is It Page Layout / Visualforce Dependent? The validation rules run at the data model level, so they are not affected by the UI. Any record that is saved in Salesforce will run through the validation rules.
What Is The Difference Between Database.insert And Insert? insert is the DML statement which is same as databse.insert. However, database.insert gives more flexibility like rollback, default assignment rules etc. Database.insert behavior can be achieved in insert by using the method setOptions(Database.DMLOptions)
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.
What Is The Scope Of Static Variable? When a method or variable as static, it’s initialized only once when a class is loaded. Static variables aren’t transmitted as part of the view state for a Visualforce page. Static variables are only static within the scope of the request. They are not static across the server, or across the entire organization.
Other Than Soql And Sosl What Is Other Way To Get Custom Settings? Custom settings have their own set of methods to access the record.
What Happens If Child Have Two Master Records And One Is Deleted? Child record will be deleted.
What Is Difference In Render, Rerender And Renderas Attributes Of Visualforce? render – It works like “display” property of CSS. Used to show or hide element. rerender – After Ajax which component should be refreshed – available on commandlink, commandbutton, actionsupport etc. renderas – render page as pdf, doc and excel.
How To Get The List Of All Available Sobject In Salesforce Database Using Apex (dynamic Apex)? Map m = Schema.getGlobalDescribe();
How To Get All The Fields Of Sobject Using Dynamic Apex? Map m = Schema.getGlobalDescribe() ; Schema.SObjectType s = m.get(‘API_Name_Of_SObject’) ; Schema.DescribeSObjectResult r = s.getDescribe() ; Map fields = r.fields.getMap();
What Is Property In Apex? Explain With Advantages.? Apex mainly consists of the syntax from the well known programming language Java. As a practice of encapsulation in java we declare any variable as private and then create the setters and getters for that variable.
What Is The Controller Extension? Any apex class having a public constructor with Custom Controller or Standard Controller object as a single argument is known as controller extension.
Explain the Use/Importance Of The Controller Extension.? Controller extension is very useful and important concept introduced by the salesforce recently. It gives the power to programmer to extend the functionality of existing custom controller or standard controller. A Visualforce can have a single Custom controller or standard controller but many controller extensions. We can say that the custom extension is the supporter of custom or standard controller.
How To Read The Parameter Value From The Url In Apex? String recordType = Apexpages.currentPage().getParameters().get(‘RecordType’);
If One Object In Salesforce Have 2 Triggers Which Runs “before Insert”. Is There Any Way To Control The Sequence Of Execution Of These Triggers? has documented that trigger sequence cannot be predefined. As a best practice create one trigger per object and use comment blocks to separate different logic blocks. By having all logic in one trigger you may also be able to optimize on your SOQL queries.
What Is The Difference Between And Trigger.old In Apex – Sfdc? Returns a list of the new versions of the sObject records Note that this sObject list is only available in insert and update triggers i.e., is available in before insert, after insert, before update and after update In the records can only be modified in before triggers. Trigger.old: Returns a list of the old versions of the sObject records Note that this sObject list is only available in update and delete triggers. i.e., Trigger.old is available in after insert, after update, before delete and after update.
How To Restrict Any Trigger To Fire Only Once? Triggers can fire twice, once before workflows and once after workflows. “The before and after triggers fire one more time only if something needs to be updated, If the fields have already been set to a value, the triggers are not fired again.” Workaround: public class HelperClass { public static boolean firstRun = true; } trigger affectedTrigger on Account (before delete, after delete, after undelete) { if(Trigger.isBefore){ if(Trigger.isDelete){ if(HelperClass.firstRun){ Trigger.old[0].addError(‘Before Account Delete Error’); HelperClass.firstRun=false; } } } }
What Are Global Variables Explain With Examples? Global variables are the variables used to reference the current user or your organization on a page. 1. $Action 2. $Api 3. $Component 4. $ComponentLabel 5. $CurrentPage 6. $Label 7. $Label.Site 8. $ObjectType 9. $Organization 10. $Page 11. $Profile 12. $Resource 13. $SControl 14. $Setup 15. $Site 16. $User 17. $UserRole 18. $System.OriginDateTime 19. $ User.UITheme and $User.UIThemeDisplayed
How To Create Many To Many Relationships Between Object? Creating Many to Many relationship in salesforce is little tricky. You cannot create this type of relationship directly. Follow below steps to create this type of relationship. Create both objects which should be interlinked. Create one custom object (also called as junction object), which should have auto number as unique identification and create two master relationships for both objects, no need create tab for this object. Now on both objects, add this field as related list.
In Which Sequence Trigger And Automation Rules Run In The following is the order salesforce logic is applied to a record. 1. Old record loaded from database (or initialized for new inserts) 2. New record values overwrite old values 3. System Validation Rules 4. All Apex “before” triggers (EE / UE only) 5. Custom Validation Rules 6. Record saved to database (but not committed) 7. Record reloaded from database 8. All Apex “after” triggers (EE / UE only) 9. Assignment rules 10. Auto-response rules 11. Workflow rules 12. Escalation rules 13. Parent Rollup Summary Formula value updated (if present) 14. Database commit 15. Post-commit logic (sending email)
What Is S-control? S-Controls are the predominant widgets which are completely based on Javascript. These are hosted by salesforce but executed at client side. S-Controls are superseded by Visualforce now.
What Is A Visualforce Page? Visualforce is the new markup language from salesforce, by using which, We can render the standard styles of salesforce. We can still use HTML here in Visualforce. Each visualforce tag always begins with “apex” namespace. All the design part can be acomplished by using Visualforce Markup Language and the business logic can be written in custom controllers associated with the Page.
Will Visual Force Still Supports The Merge Fields Usage Like S-control? S-Controls, Visualforce Pages support embedded merge fields, like the {!$User.FirstName} used in the example.
. What Are Merge Fields? Explain With Example? Merge fields are fields that we can put in Email templates, mail merge templates, custom link or formula fields to incorporate values from a record. Example: {!CustomObject.FieldName__c}
Where To Write Visualforce Code? You can write the code basically in 3 ways. 1. setup->App Setup->Develop->Pages and create new Visulaforce page. 2. Setup -> My Personal Information -> Personal Information -> Edit check the checkbox development mode. When you run the page like this, will find the Page editor at the bottom of the page. You can write you page as well as the controller class associated with it, there itself. 3. Using Eclipse IDE you can create the Visulaforce page and write the code.
What Is Difference In Isnull And Isblank? ISNULL: Determines if an expression is null (blank) and returns TRUE if it is. If it contains a value, this function returns FALSE. Text fields are never null, so using this function with a text field always returns false. For example, the formula field IF(ISNULL(new__c) 1, 0) is always zero regardless of the value in the New field. For text fields, use the ISBLANK function instead. Multi-select picklist fields are never null in s-controls, buttons, and email templates, so using this function with a multi-select picklist field in those contexts always returns false. Empty date and date/time fields always return true when referenced in ISNULL functions. Choose Treat blank fields as blanks for your formula when referencing a number, percent, or currency field in an ISNULL function. Choosing Treat blank fields as zeroes gives blank fields the value of zero so none of them will be null. Merge fields can be handled as blanks, which can affect the results of components like s-controls because they can call this function. When using a validation rule to ensure that a number field contains a specific value, use the ISNULL function to include fields that do not contain any value. For example, to validate that a custom field contains a value of ’1,’ use the following validation rule to display an error if the field is blank or any other number: OR(ISNULL(field__c), field__c1} ISBLANK: Determines if an expression has a value and returns TRUE if it does not. If it contains a value, this function returns FALSE. Use ISBLANK instead of ISNULL in new formulas. ISBLANK has the same functionality as ISNULL, but also supports text fields. will continue to support ISNULL, so you do not need to change any existing formulas. A field is not empty if it contains a character, blank space, or zero. For example, a field that contains a space inserted with the spacebar is not empty. Use the BLANKVALUE function to return a specified string if the field does not have a value; use the ISBLANK function if you only want to check if the field has a value. If you use this function with a numeric field, the function only returns TRUE if the field has no value and is not configured to treat blank fields as zeroes.
How To Schedule A Class In Apex? To invoke Apex classes to run at specific times, first implement the Schedulable interface for the class, then specify the schedule using either the Schedule Apex page in the Salesforce user interface, or the System.schedule method. After you implement a class with the Schedulable interface, use the System.Schedule method to execute it. The scheduler runs as system: all classes are executed, whether the user has permission to execute the class or not. The System.Schedule method takes three arguments: a name for the job, an expression used to represent the time and date the job is scheduled to run, and the name of the class. Salesforce only adds the process to the queue at the scheduled time. Actual execution may be delayed based on service availability. The System.Schedule method uses the user’s time zone for the basis of all schedules. You can only have 25 classes scheduled at one time. Example Code: String CRON_EXP = ‘0 0 * * * ?’; clsScheduledHourly sch = new clsScheduledHourly(); system.schedule(‘Hourly Sync’, CRON_EXP, sch);
In SalesForce – what is REST API? REST API provides a powerful, convenient, and simple REST-based Web services interface for interacting with Salesforce. Its advantages include ease of integration and development, and it’s an excellent choice of technology for use with mobile applications and Web projects. However, if you have a large number of records to process, you may wish to use Bulk API, which is based on REST principles and optimized for large sets of data.
SOAP API: SOAP API provides a powerful, convenient, and simple SOAP-based Web services interface for interacting with Salesforce.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. For example, you can use SOAP API to integrate Salesforce with your organization’s ERP and finance systems, deliver real-time sales and support information to company portals, and populate critical business systems with customer information.
Chatter API: Chatter API is a REST API that provides programmatic access to Chatter feeds and social data such as users, groups, followers, and files. It’s used by developers who want to integrate Chatter into a variety of applications such as mobile applications, intranet sites, and third-party Web applications. Chatter API is similar to APIs offered by other companies with feeds, such as Facebook and Twitter. Its advantages include ease of integration and development.
Bulk API: Bulk API is based on REST principles and is optimized for loading or deleting large sets of data. You can use it to query, insert, update, upsert, or delete a large number of records asynchronously by submitting batches which are processed in the background by Salesforce. SOAP API, in contrast, is optimized for real-time client applications that update small numbers of records at a time. Although SOAP API can also be used for processing large numbers of records, when the data sets contain hundreds of thousands of records, it becomes less practical. Bulk API is designed to make it simple to process data from a few thousand to millions of records. The easiest way to use Bulk API is to enable it for processing records in Data Loader using CSV files. This avoids the need to write your own client application.
Metadata API: Use Metadata API to retrieve, deploy, create, update, or delete customizations for your organization. The most common use is to migrate changes from a sandbox or testing organization to your production environment. Metadata API is intended for managing customizations and for building tools that can manage the metadata model, not the data itself. The easiest way to access the functionality in Metadata API is to use the IDE or Migration Tool. These tools are built on top of Metadata API and use the standard Eclipse and Ant tools respectively to simplify the task of working with Metadata API. Built on the Eclipse platform, the IDE provides a comfortable environment for programmers familiar with integrated development environments, allowing you to code, compile, test, and deploy all from within the IDE itself. The Migration Tool is ideal if you want to use a script or a command-line utility for moving metadata between a local directory and a Salesforce organization.
Streaming API: Use Streaming API to receive notifications for changes to data that match a SOQL query that you define. Streaming API is useful when you want notifications to be pushed from the server to the client. Consider Streaming API for applications that poll frequently. Applications that have constant polling action against the Salesforce infrastructure, consuming unnecessary API call and processing time, would benefit from this API which reduces the number of requests that return no data. Streaming API is also ideal for applications that require general notification of data changes. This enables you to reduce the number of API calls and improve performance.
Apex REST API: Use Apex REST API when you want to expose your Apex classes and methods so that external applications can access your code through REST architecture. Apex REST API supports both OAuth 2.0 and Session ID for authorization.
Apex SOAP API: Use Apex SOAP API when you want to expose your Apex methods as SOAP Web service APIs so that external applications can access your code through SOAP. Apex SOAP API supports both OAuth 2.0 and Session ID for authorization.
How To Display Error Message On Visualforce Page? In the controller class add the error message where required if ( requiredFieldName == null){ ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, ‘Please enter a value in the Required Field’)); }
What Is Visualforce View State? And What Are Best Practices To Reduce The View State Size? isualforce pages that contain a form component also contain an encrypted, hidden form field that encapsulates the view state of the page. This view state is automatically created, and as its name suggests, it holds the state of the page – state that includes the components, field values and controller state. Best Practices to reduce the view state size: Minimize number of form on a page. Use apex:actionRegion instead of using 2 or more forms Refine your SOQL to only retrieve the data needed by the page. All public and private data members present in Standard, Custom and Controller extensions are saved. Mark any Apex variables that are not necessary to the view state as Transient. (The transient variables are not passed to view state and therefore not stored in View State) Create wizards with as few pages as possible Use outputLink components instead of commandLink or commandButton components where possible as they don’t need to be nested in a form.
What Are Custom Settings? Custom settings are similar to custom objects and enable application developers to create custom sets of data, as well as create and associate custom data for an organization, profile, or specific user. All custom settings data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database. This data can then be used by formula fields, validation rules, Apex, and the SOAP API. two types of custom settings: List Custom Settings and Hierarchy Custom Settings
What are List Custom Settings A type of custom setting that provides a reusable set of static data that can be accessed across your organization. If you use a particular set of data frequently within your application, putting that data in a list custom setting streamlines access to it. Data in list settings does not vary with profile or user, but is available organization-wide. Because the data is cached, access is low-cost and efficient: you don’t have to use SOQL queries that count against your governor limits.
Hierarchy Custom Settings A type of custom setting that uses a built-in hierarchical logic that lets you “personalize” settings for specific profiles or users. The hierarchy logic checks the organization, profile, and user settings for the current user and returns the most specific, or “lowest,” value. In the hierarchy, settings for an organization are overridden by profile settings, which, in turn, are overridden by user settings.
Apex vs. Java: Commonalities Both have classes, inheritance, polymorphism, and other common OOP features. • Both have the same name variable, expression, and looping syntax. • Both have the same block and conditional statement syntax. • Both use the same object, array, and comment notation. • Both are compiled, strongly-typed, and transactional.
What is External-Id An external ID is a custom field that has the “External ID” attribute, meaning that it contains unique record identifiers from a system outside of Salesforce. When you select this option, the import wizard will detect existing records in Salesforce that have the same external ID. Note that this operation is not case-sensitive
How many External-Ids are allowed? Salesforce allows you mark up to 3 fields as External IDs and these fields must be text, number or email field types. Values in these External ID field must also be unique and you can also determine whether or not value are case sensitive