Sunteți pe pagina 1din 39

In this Salesforce Interview Questions Post i cover on various Salesforce

interview questions asked in top MNC companies (Capgemini, Accenture,


Deloitte,HP, CTS, TCS, Citrix, iGate, L&T, KPIT, American Express, FIS, CEB,
NCR Crop etc)

Capgemini f2f Interview Questions

1)Briefly explain about yourself?


2)What is salesforce architecture?
3)What all the services provided in cloud computing?
4)what all the services that salesforce supports?
5)what is the difference between profiles and roles?
6)what are web services? why we need to go for them? What is WSDL? What is
SOAP?
7) Here you attended capgemini written test. If you got selected here you will be
sent to technical round..if you got selected in technical round then you will be sent
to HP for client interview, because HP is client to capgemini. If you got selected
finally.Then you will be put into work. This is the scenario. which process do you
apply here either "WORKFLOWS" or "APPROVALS".(I said approvals,i don't
know whether it's correct or not).
8)How can you say that it's "APPROVAL"? (i said first we need to be approved in
first round then only we will be sent to the next).
9) How you will make a class available to others for extension? (Inheritance
concept)
10) In the process of creating a new record, how you will check, whether user has
entered email or not in the email field of Account object?
11)How you will write a java script function that display an alert on the
screen?12)What is the value of "renderas" attribute to display o/p in the form of
Excel Sheet?
13)How you will get the java script function into Visual-force page?
14)Can we create a dashboard using Visual-force page? and what all the
components we use here?
15)What are web tabs?
16)How you will add an attachment from VF page? tell me the component names to
achieve this functionality?
17)Security(OWD, Sharing Rules,Manual Sharing).
18)Rate yourself in salesforce?
19)what is your current package?
20)How much you are expecting?
21)You will be given pen and paper, they will ask you to write some simple code.

Accenture Interview Questions


1) What is Dynamic Approval process?
2) Flow of execution in validations, triggers & workflows?
Ans: all before triggers, Validations, Workflows, All after triggers.
3) Assignment process & validations.
4) Difference between Trigger.new & Trigger.old?
5) Trigger events? & context variables?
6) Batch Apex?
7) Will one workflow effects another workflow?
8) Syntax for upsert & undelete trigger & Purpose undelete?
9) Case management?
10) If we want to upload data through DataLoader, what the changes to be done?

Deloitte F2F Interview Question


1. We have 3 objects Account, Contact, Opportunity. In a VF page, we need to
display the names of contact & Opportunity which are related to Account.
2. One object (s1) & 3 tasks (t1, t2, t3) are there. Each task performing discount
related stuff. Write a trigger that should calculate the sum of 3 tasks. And if any
task is modified than trigger should fire automatically & perform the same.

Ans: List<Task> listof tasks = [select id, name from Task where
whatId=Trigger.new];

3. How can you convert a lead?


4. What is your Role in your project?
5. Explain 2 VF pages developed by you?
6. How will you deploy? Have you ever involved in deployment?
7. How will you test your code through Sandbox?
8. What is the custom settings ?
9. Difference between SOSL and SOQL in Salesforce ?
10. Custom settings?
11. What is Sales cloud & Service cloud?
12. can a Checkbox as controlling field?
13. Sharing Rules?
14. SOQL & SOSL? Diff between SOQL & SOSL?
15. Difference b/w External ID & Unique ID?
16. What is System.RunAs ()?
17. Explain Test.setPage ()?
18. Why Governor Limits are introduced in Salesforce.com?

TCS F2F interview

1. About project?
2. What are standard objects used in your project?
3. Call outs?
4. Governor Limits?
5. Relationships
6. Different types of field types?
7. Data Migration?
8. Roll-up summary?
9. What is the difference between sales cloud & service cloud?

American Express F2F Interview Questions

1) Trigger should perform based on user requirement?


It should Trigger when user want to trigger & shouldn’t when trigger don’t want?
2) What are default methods for Batch Apex?
Ans: start(), execute() and finish()
3) Analytical snapshot?
4) Types of Triggers?
5) Other than Data Loader any other way to import Bulk Data?
6) Explain any scenario occurred you to work beyond Governor
Limits?7) How u will do Mass Insert through trigger?
8) If I want to Insert, Update any record into ‘Account’. What trigger I have to
use?
What is Force.com and Salesfore.com? Mention the differences.
Force.com is a cloud computing platform where the developers build multitenant applications.
Salesforce.com is also a cloud computing platform, it contains only standard objects.
Salesforce.com is hoisted on Force.com.

What are the Force.com editions and salesfoce.com editions?


Force.com includes 5 editions.
Free edition
Enterprise with one app
Enterprise with multiple app
Unlimited with one app
Unlimited with multiple apps

SalesForce.com includes 5 editions


Contact Manager
Group
Professional edition
Enterprise edition
Unlimited edition
How many custom objects available in Professional and Enterprise edition and Unlimited?
Professional 50
Enterprises 200
Unlimited 2000

In Which edition the Apex Data Loader will support? What are those editions?
Earlier Enterprise and Unlimited editions use to support Apex data loader. Now, Professional, Enterprise and Unlimited
edition supports data loader.

Through Sales force Import wizard how many records we can import into S.F Objects and the wizard will support for
which Objects?
Using Import wizard, we can upload up to 50000 records. And only Accounts, Contacts and custom object’s data can be
imported. If we want to import other objects like Opportunities and other object’s data, then we need to go for Apex
Data Loader.

In which edition work flows are available in S.F?


In Enterprise edition and in unlimited edition, we have these work flows. We do not have these work flows in group and
professional editions. We can get these workflows in professional edition also as an add-on.

What is the data and file storage capacity in Professional and Enterprise and Unlimited editions Org wide? What is the
storage capacity for each user in above editions?
Data storage (Org) File storage (Org) Dstorage/Fstorage(User)
Professional 1GB 1GB 20MB/100MB
Enterprises 1GB 1GB 20MB/100MB
Unlimited 1GB 1GB 120MB/100MB

In Which Edition Outlook and Excel and Mobile Lite are available in S.F?
Mobile Lite users can view, create, edit, and delete accounts, assets, contacts, leads, opportunities, events, tasks, cases,
and solutions from mobile.
Mobile lite is available in all editions i.e.; Group edition, Professional edition, Enterprise edition, Unlimited edition.
Outlook connect to sales force is used to sync contacts, Events and mails to sales force. Like mobile lite feature this is
also available in all above mentioned editions.

What is app exchange?


The developed custom applications can be uploaded into the app exchange so that the other person can share the
applicaition.

What is a VLOOKUP in S.F?


VLOOKUP is actually a function in sales force which is used to bring relevant value to that record from another record
automatically.

What are the types of bindings available in Visual force?


Using get; set in apex, we can bind variables in visual force.
ex: public String textdemo{get;set;} // in apex
<apex:input text value=”{!textdemo}”>
Using methods in controller
Ex: <apex:selectlist value=”textdemo”>
<apex:selectoptions value=”listt”/>
</apex:selectoptions>
//In apex
Public List<Account> getlistt(){
Return [select Id,Name from Account]; \\ returns list
}

What are the types of relationships present in S.F?


4 types
Master-Detail
Lookup
Junction Object
Hierarchy

What is junction Object and what does it mean?


Junction object is a custom object which is used to create many to many relationship between two objects.
It always contains two Master-Detail relationships.

Differences between Master-Detail and Lookup


Both are used to create one to many relationship between two objects.
In case of MD, if Parent is deleted, child is also deleted.
In case of Lookup, if Parent is deleted, child is not deleted.

In MD, Child is mandatory, but in Lookup, child is not mandatory.

When I want to export data into SF from Apex Data Loader, which Option should be enable in Profile?
Enable API

Types of Reports in S.F?


3 types of reports in S.F
Tabular reports: Tabular report is used to represent the data simply in tabular format. Summarizing on a particular
field cannot be done.

Summary reports: In summary report, we can summate or group the data based on a column.

Matrix report: In matrix report we can summarize the data both in rows and columns.

What is an Assignments rule?


It is a Rule to specify how leads are assigned to users or queues as they are created manually, captured from the web, or
imported via the lead import wizards.

What is a web- lead?


Capturing a lead from a website and routing it into lead object in Sales Force is called wed-lead (web to lead).

What is lookup and Master Details and what is difference between them.
Both Lookup and Master detail fields are used to link a record in one object to another record in another object.
In lookup, if we delete master records, child records will not be deleted.
In master-detail, if we delete master records, child records will also be deleted.

Child record is mandatory for Master-Detail.


What is an External Id?
External Id is an id that can be given to any field in an object. An external id will be generated on the field that we
mention. This field will be used to detect duplicate values when we try to import data into sales force using an external
system like apex data loader, informatica data loader etc.

What are the Types of Account and difference between them?


We have two types of accounts.
Personal accounts
Business accounts.
In personal accounts, person’s name will be taken as primary considerations where as in business accounts, there will be
no person name, but company name will be taken into consideration.

How many ways to do a field is mandatory?


There are two ways to declare a field to be mandatory.
At the time of creating the field, mentioning the field should contain a value to save a record.
In page layout, we can mention the field to be mandatory.

What is a Field level Security?

Giving permissions to users based on Profiles.


Mentioning the availibity of a field to the users for viewing and editing purpose based on profile is called field level
security.
While creating a field,we can mention the security level of that field fr every profile by deciding its level of accessibility
to each profile.

Difference between Formula and Roll-up summary


Formula: is a read only field that derives a value from a formula expression that we define.
Roll-up summary: A read-only field that displays the sum, minimum, or maximum value of a field in a related list or the
record count of all records listed in a related list.

Difference btw isNull and isBlank


IsNull – it supports for Number field.
IsBlank- it supports for Text field.

What is a workflow? Types of workflow and actions in workflow.


Workflow is a force platform business logic engine that allows us to automatically send email alerts, assign tasks, field
updates based on rules that we define.

2 types:
Immediate actions: That executes when a record matches the criteria.
Time-dependent: When a record matches the criteria, and executes according to time triggers.
Actions:
Task : Asign a new task to user.
Email-alerts : Send email to one or more recipients that are specified.
Field Updates : Update value of a field.
Outbound Messages: Send a configurable API message to designed listener.

Types of email templates

Text
Html with letter head
Custom Template
Visual Force.

Difference btw Profiles and Roles


Profiles: Field level or Object level security can be given by profiles
Roles: Record level security can be given by Roles.

Profile is mandatory.

Types in roles:

Manual Sharing
OWD (organization wide default):
Public read
Public read/write
Private
Sharing rules
Role Hierarchy

What is a wrapper class?


A wrapper class is a class whose instances are collections of other objects.

What are collections and types of collections?


Collection is an object which groups multiple elements into a single unit.

List: Ordered collection of elements which allows duplicates.


Set: Unordered collection of elements which do not allow duplicates.
Map: Pair of two elements, in which the first element is always unique.

Types of Reports:
Tabular: Display data in a tabular form. No summarizing is allowed.
Summary: Summarize data on one column based on single criteria.
Matrix: Summarize data on both row and columns.
Difference between VF and S-Control
VF S-Control

It is a markup language like XML, HTML It is a procedural language like Java, Ajax
Automation of data is there- Binding No automation of data- Manual Binding
Style sheet(CSS) is included CSS is not included
Native
Accessibility of object

{! ($Objecttype.ObjectName.accessable)}----------- returns true if object is accessible.

What are Global keywords?


Used to access various values from components on a page or from user objects or from URL, for each object we have
each key word.

URL Current Page


Profile Page Reference
User Object Type
Resource Component

What is a Page Reference?


Page reference is a class in apex, which is used to redirect to another page.
By creating an object to this class, we can use this object to forward to another page as shown in example below:
Public Pagereference go()
{
Pagereference p = new pageReference(‘http://www.google.com’);
Return p;
}

What is MVC?
The main aim of the MVC architecture is to separate the business logic and application data from the presentation data
to the user.

Model: The model object knows about all the data that need to be displayed.
View: The view represents the presentation of the application (User Interface).
Controller: Actual business logic of VF is present here.

What are the Controllers available in Force.com?


3 types of controllers are available
Standard Controller: Used for both custom and standard objects.
Custom Controller: is an apex class that implements all the logic for a page without leveraging the functionality of a
standard controller.
Extension Controller: is an apex class which adds functionality to existing standard and custom controllers.

What is a difference between render, rerender and renderAs?


Render: is an attribute used in VF to hide or show certain components in visual force page.
Rerender: Used to refresh a part of a page in visual force page when an action occurs.
Render as: Used to convert entire visual force into PDF
Render as = “pdf”.

How can you access URL Parameters in to a visual force page?


Using $CurrentPage, you can access the query string parameters for the page by specifying the parameters attribute,
after which you can access each individual parameter.
$CurrentPage.parameters.parameter_name

Ex: $CurrentPage.parameters.location

What are annotations ant their types?


Annotations are used to bypass the methods in the way they execute.
@Future: Used to execute the methods asynchronously.
@IsTest: Used to test the methods.
@ReadOnly
@Deprecated
@Remote Action

What is a difference between <apex: dataTable />, <apex: pageBlockTable />?


Only standard style sheets used in page block table,
If we want to add custom style sheets we have to data table.

What is a Sandbox? Types of sandbox.


Sandbox is the exact replica of the production.
3 Types:
Configuration
Developer
Full

What are triggers? Types of Triggers


Trigger is a piece of code that is executed before or after a particular field of certain type is inserted, updated or deleted.
Bulk Trigger: All triggers are bulk triggers by default, and can process multiple records at a time. You should always plan
on processing more than one record at a time.
Bulk triggers can handle both single record updates and bulk operations like:
Data import
Mass actions, such as record owner changes and deletes
Recursive Apex methods and triggers that invoke bulk DML statements.
Recursive trigger:

ActionSupport: A component that adds AJAX support to another component, allowing the component to be refreshed
asynchronously by the server when a particular event occurs, such as a button click or mouseover.
ActionFunction: A component that provides support for invoking controller action methods directly from JavaScript
code using an AJAX request.
ActionPoller: A timer that sends an AJAX update request to the server according to a time interval that you specify.
What is Batch Apex? How can you implement Batch Apex?(Dynamic Apex)
Batch Apex gives you the ability to operate over large amounts of data by chunking the job into smaller parts, thereby
keeping within the governor limits.
Using batch Apex, you can build complex, long-running processes on the Force.com platform. For example, you could
build an archiving solution that runs on a nightly basis, looking for records past a certain date and adding them to an
archive.

What is a Callout method? How does it invoke, how many methods available in Classes and Triggers?
It is used to invoke the External services HTTP or web services.
An Apex callout enables you to integrate your Apex with an external service by making a call to an external Web service
or sending a HTTP request from an Apex script and then receiving the response. Apex provides integration with Web
services that utilize SOAP and WSDL, or HTTP services (RESTful services).

What is a difference between System log and debug log?


System Log console is a separate window that displays debugging information, as well as its cumulative limits and source
code. It can be considered a context-sensitive execution viewer showing the source of an operation, what triggered that
operation, and what occurred afterward. Use the System Log console to view debug logs that include database events,
Apex processing, workflow, and validation logic.

Debug log records database operations, system processes, and errors that occur when executing a transaction or while
running unit tests. The system generates a debug log for a user every time that user executes a transaction that is
included in the filter criteria.

SOQL: Salesforce.com Object Query Language


SOSL: Salesforce.com Object Search Language
What is a Force.com IDE?
Ans. Force.com IDE is a development environment which is available as a plug-in to be installed in Eclipse and used. This
IDE can be used to work on and manipulate the salesforce structure like authoring Apex classes, Visual force pages, apex
triggers etc.,
What is a Managed Package and Unmanaged package?
Unmanaged vs. Managed
Managed packages are AppExchange packages that can be upgraded in the installer's organization. They differ from
unmanaged packages in that some components are locked, allowing the upgrade process. Unmanaged packages do not
include locked components and can not be upgraded.

Before the Winter '07 release, all packages were unmanaged. Now, you can convert an unmanaged package to managed
to ensure your installed users get upgrades.

Unmanaged Package Managed Package


What Completely Editable by Developer and Installer
Can NOT be upgraded Certain Components are locked
No Destructive Changes to app
Supports Seamless Upgrading
Supports LMA for Managing Installs
When to Use 1:1 Distribution
Extensive Modification Required 1:Many Distribution
Commerical Intent
Foresee Upgrades
Editions Supported All Editions can create Unmanaged Packages ONLY Developer Edition can create Managed
Packages

Managed packages differ from unmanaged packages in many other ways. Before creating managed packages, here are a
few things to consider:
You must use a Developer Edition organization to create and work with a managed package.
A Developer Edition organization can contain a single managed package and many unmanaged packages.
You must register a Namespace Prefix - A Namespace Prefix is a series of characters prefixed to your Custom Objects and
Fields to prevent conflict when installed in another salesforce.com org.

When you release a managed package, meaning it is uploaded with the Managed - Released option selected, the
properties of its components change to prevent developers and installers from making harmful changes. For a list of
each package component type and their properties, see Properties of Managed Packages. If you do not want to offer
upgrades to your package, consider keeping it unmanaged.

If you plan to release your app as a Managed Package, please read out guide on Planning the Release of Managed
Packages

If you already have a Unmanaged Package and you'd like to convert it to Managed, please review the following:
Converting Unmanaged Packages to Managed

Now that you understand the difference and benefits of each type of package, let's see how easy it is to make your
Unmanaged package from above into a Managed Package.

Customer portal
With Salesforce CRM’s customer portal, your customers can log cases and get updates 24x7. All via the intuitive user
experience for which Salesforce CRM is famous. The result—higher customer satisfaction at a lower cost.

Partner portal
Outsource your service management by allowing third-party service reps to manage customer cases via the partner
portal. Service partners can do everything they need to resolve customer support issues: search the solution database,
log cases, make case comments, and run reports.

53.What are the rules Criteria to create a work flow? How many ways to fire a work flows and when should those
available? What are the actions in work flow?
Ans. Criteria that cause salesforce.com to apply the workflow rule.
Immediate actions that execute when a record matches the criteria.
Time-dependent actions that salesforce.com queues when a record matches the criteria, and executes according to
time triggers.
In 2 ways,
1. Immediate action: when criteria matches record then workflow will be fired immediately.
2. Timedependent action: Fires according to time triggers.
Tasks - Assign a new task to a user, role, or record owner.
Email Alerts - Send an email to one or more recipients you specify.
Field Updates - Update the value of a field on a record.
Outbound Messages - Send a secure configurable API message (in XML format) to
a designated listener.

54. Types of Sandboxes and what are those and In Which editions those are available?
Ans. 3 types of Sandboxes available, those are Developer, Full and Configuration. In all editions.
55. What is test coverage code % for the classes and triggers and what is the test method syntax?
Ans. 75%.

56.Types of Triggers and what is a Bulk Trigger?


Ans. All triggers are bulk triggers by default, and can process multiple records at a time. You should always plan on
processing more than one record at a time.
Bulk triggers can handle both single record updates and bulk operations like:
Data import
Bulk Force.com API calls
Mass actions, such as record owner changes and deletes
Recursive Apex methods and triggers that invoke bulk DML statements.

57.What are the types of bindings available in Visual force?


Ans . 1. Using GET-SET in apex, we can bind variables in visual force.
2. Using methods in controller.

58. What is a Wrapper Class in S.F?


Ans. A wrapper class is a class whose instances are collections of other objects.

59. What are formula and Rollup Summary fields and Difference between them? When should Rollup- Summary field
enable?
Formula: A read-only field that derives its value from a formula expression that we define. The formula field is updated
when any of the source fields change.
Rollup Summary: A read-only field that displays the sum, minimum, or maximum value of a field in a related list or the
record count of all records listed in a related list.

Difference is below:
Formula fields calculate values using fields within single record, roll-up summary fields calculate values from a
set of related records.
When we give the master-detail relationship it get’s enable to the master object

11. 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__c<>1)

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. Salesforce.com 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.

for further study you can read this link.

12. Is it possible to write the Apex code from user Interface?

You can add, edit, or delete Apex using the Salesforce.com user interface only in a Developer Edition organization,
a Salesforce.com Enterprise Edition trial organization, or sandboxorganization. In a Salesforce.com production
organization, you can only make changes to Apex by using the Metadata API ,

deploycall, the Force.com IDE, or theForce.com Migration Tool. The Force.com IDE and Force.com Migration Tool are
free resources provided by salesforce.com to support its users and partners, but are not considered part of our Services
for purposes of the salesforce.com Master Subscription Agreement.

13. When you can’t add Time dependent action in Workflow rule?
You can’t add time-dependent actions to a rule if you choose Every time a record is created or edited.

For more study, check this article

14. What are the types of email templates available in salesforce.com?

1. Text
2. HTML with Letter Head

3. Custom HTML

4. Visual force

To study more on email templates, refer this article

15. What are the different Salesforce.com Editions and Limits?

Ans : check this URL

16. What is Roll up summary field in Salesforce?

Roll up summary field in salesforce calculates the Count, Sum, Min or Max of particular field of any child record. Thus,
we can say that Roll up summary field can only be created on Master object. To read further, please check this URL

17. What will happen if the Account is deleted?

If the Account is deleted then Contact, Opportunity will also be deleted from Salesforce which are related to that
Account.

From the database perspective, check below image of child relationships of Account:

1. What is Salesforce?
Salesforce is the most effective Customer Relationship Management (CRM) product that is
delivered to subscribers as cost effective software-as-a-service (SaaS).
2. What is a custom object in Salesforce?
In Salesforce, custom objects refer specifically to database tables that store data related to your
company in Salesforce.com.
3. What does a custom object permit the user to do?
Once the custom object is defined, the subscriber can perform the following tasks: Create
custom fields, relate the custom object to other records, track events and tasks, build page
layouts, create a custom tab for the custom object, analyze custom o bject data and create
dashboards and reports, share custom tabs, custom apps, custom objects, and various other
related components. None of these tasks can be accomplished until the custom object has
definition.
4. What is a Self-Relationship?
A Self-Relationship is a lookup relationship to the same object. It is this premise that allows
users to take the object “Merchandise” and create relationships with other object.
5. What is the Object Relationship Overview?
In Salesforce, the object relationship overview links custom object records to standard object
records in a related list. This is helpful to track product defects in related customer cases.
6. What can cause data loss in Salesforce?
Data loss in Salesforce can be caused by a number of reasons, including:

 Changing data and date-time


 Migrating to percent, number, and currency from other data types
 Changing from multi-select picklist, checkbox, auto number to other types
 Altering to multi-select picklist from any type except picklist
 Changing to auto-number except from text
 Changing from text-area to e-mail, phone, URL, and text

7. How is SaaS beneficial to Salesforce?


SaaS is subscription-based, so clients can choose not to renew and discontinue using the
program at any time without penalty other than not being able to use Salesforce. SaaS is
intended to help users avoid heavy initial startup fees and investments. SaaS applications use
a simple Internet interface supported by easy integration.
8. How does Salesforce track sales?
Salesforce is a tracking program that records a number of helpful basic details, such as:

 Number of customers served daily


 Daily sales volume
 Detailed reports from Sales Manager
 Sales figures by month or quarter
 Most importantly, Salesforce tracks and reports repeat customer acti vity, which is the key to
any sales organization.
 9. How many types of relationships are offered by Salesforce.com?
 Salesforce recognizes two relationship types: Master-detail relationships and Lookup
relationships.
 10. What is the trigger?
 Trigger is the code that is executed before or after the record is updated or inserted.
 11. What is the difference between Trigger and Workflow?
 Workflow is an automated process that fire an action based upon evaluation criteria and
rule criteria. As described above, Trigger is the code that is executed on or after the record
is updated or inserted.
 12. What is static resource in Salesforce?
 With Salesforce’s static resource, subscribers can upload zip files, images, jar files,
JavaScript, and CSS files that can be referred in a Visualforce page. The optimum size
of static resources in Salesforce is 250 MB.

13. What is the difference between Force.com and Salesforce.com?


Force.com is a Platform-as-a-Service (PaaS), while Salesforce.com is Software-as-a-Service
(SaaS).
14. Is there a limit for data.com records?
Salesforce users can see their limit form setup easily by simply clicking data.com
administration/Users. From the data.com users section, the users can see their monthly limit
and exactly how many records are exported during the month.
15. What are the three types of object relations in Salesforce?
The three types of object relations in Salesforce are:

 One-to-many
 Many-to-many
 Master-detail

The relation types are quite logical once the user becomes familiar with the software program.
16. What are the different types of reports available in Salesforce?
The different types of reports in Salesforce are:

 Tabular report that displays the grand total in table form


 Matrix report where grouping is based upon both rows and columns
 Summary reports that are detailed reports in which the grouping is based on columns.
 Joined report which allows two or more reports to be joined in a single report.

17. Is it possible to schedule a dynamic dashboard in Salesforce?


In Salesforce, it is not possible to schedule a dynamic dashboard.
18. What is the junction object and what purpose does it serve?
Junction objects are used to build many-to-many relationships between objects. For example,
the user can take a recruiting application where a position for a job can be linked to many
candidates or can take a candidate and link the candidate to many other jobs. In order to connect
the data model, a third party object is referred to as junction object. In the given example, the
junction object is “job application.”
19. What is an Audit Trail?
The Audit Trail function in Salesforce is useful for gaining information or for tracking all the
recent setup changes that the administration has done in the organization. The audit trail can
preserve data for up to six months.
20. Explain the Salesforce dashboard?
In Salesforce, the dashboard is a pictorial representation of the report. 20 reports can be added
to a single dashboard.
21. What is the difference between SOQL and SOSL?
SOQL is Salesforce Object Query Language and SOSL is Salesforce Object Search Language.
If you are sensing that Salesforce is a culture unto itself, you are correct!
22. What is a Wrapper Class?
A Wrapper Class is a class whose instances are a collection of other objects and is used to
display different objects on a Visualforce page in the same table.
23. What is the sharing rule?
The sharing rules are applied when a user wishes to allow access to other users.
These 23 most common questions and answers will help you prepare effe ctively and perform
well in Salesforce interviews. Study them thoroughly to make a good impression on your
prospective employers.

Salesforce allows users to define different types of relationships by creating custom relationship
fields on an object.

Account Child relationship in salesforce

If we use schema builder, released in Winter 12 it would look like:


Account Contact and Opportunity of salesforce in schema builder

18. How many types of the relationship fields available in Salesforce>

Ans :

1. Master Detail

2. Many to Many

3. Lookup

4. Hierarchical

For further study read this.

19. 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 autonumber as unique identification and
create two master relationships for both objects, no need create tab for this object.

Now on both object, add this field as related list.

20. In Which sequence Trigger and automation rules run in Salesforce.com 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)

Additional notes: There is no way to control the order of execution within each group above.

21. 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?
Ans : Salesforce.com 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.

22. How to delete the User from Salesforce?


Ans : As per now, salesforce does not allow to delete any user, however you can deactivate the user.
Read further…

23. How to delete the users data from Salesforce?


Ans : To delete the Users Data go to Setup | Administration Setup | Data Management | Mass Delete Record, from
there select the objects like Account, Lead etc and in criteria select the users name and delete all records of that user
related to particular object.

24. How to restrict the user to see any record, lets say opportunity?
Ans : set up opportunity sharing to be private. If both users are admins or have view all records on opportunity, then
that overrides private sharing.
25. What is the difference between trigger.new and trigger.old in Apex – SFDC?
Ans :
Trigger.new :
Returns a list of the new versions of the sObject records.
Note that this sObject list is only available in insert and update triggers, and 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.

26. How to restrict any Trigger to fire only once ?


Ans:
Triggers can fire twice, once before workflows and once after workflows, this is documented at
http://www.salesforce.com/us/developer/docs/apexcode/ Content/ apex_triggers_order_of_execution.htm:
“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:
Add a static boolean variable to a class, and check its value within the affected triggers.

1 public class HelperClass {

2 public static boolean firstRun = true;

3}

4 trigger affectedTrigger on Account (before delete, after delete, after undelete) {

5 if(Trigger.isBefore){

6 if(Trigger.isDelete){

7 if(HelperClass.firstRun){

8 Trigger.old[0].addError('Before Account Delete Error');

9 HelperClass.firstRun=false;

10 }

11 }

12 }

13 }

27. What is difference between WhoId and WhatId in the Data Model of Task ?
Ans :
WhoID refers to people things. So that would be typically a Lead ID or a Contact ID
WhatID refers to object type things. That would typically be an Account ID or an Opportunity ID
Check Data Model of task here

28. Where is the option of the report for the “Custom Object with related object” and what are the condition to
generate related reports?
Ans :
If the parent object is the standard object provided by the salesforce like “Account”, “Contact” then the report will be in
there section with related custom object.
If both objects are the custom then the report will be in “Other Reports” Sections.
Following are the conditions to get the report of related objects:

 On both the objects, Reports option must be enable.

 The relationship between both of them must be “Master – detail relationship”.

Read this article, to get detailed idea on this topic.

29. How you can provide the User Login (Authentication) in Public sites created by Salesforce.
Answer : We can provide the authentication on public sites using “Customer Portal”.

Q. Does user can create insert their own custom logo, while creating their own custom
applications?
Yes user can upload their custom logo in documents and then they choose that logo for organization.

Q. List things that can be customized on page layouts?


We can customize different things on page layout like, Fields, Buttons, Custom Links and Related Lists. We can also
create sections.

Q. What is a “Self Relationship”?


Self Relationship is a lookup relationship to the same object. Suppose let’s take an object “Merchandise”. Here we
can create relationship in between the Account to Account (same object) object. That is called “Self Relationship”.

Q. What are the main things need to consider in the “Master-Detail Relationship”?
Record level access is determined by the parent, Mandatory on child for reference of parent, cascade delete (if you
delete the parent, it can cascade delete the child).
Q. What is difference between trigger and workflow?
Workflow
Workflow is automated process that fired an action based on Evaluation criteria and rule criteria.
We can access a workflow across the object.
We cannot perform DML operation on workflow
We cannot query from database
Trigger
Trigger is a piece of code that executes before or after a record is inserted or updated.
We can access the trigger across the object and related to that objects
We can use 20 DML operations in one trigger.
We can use 20 SOQL’s from data base in one trigger.

Q. What is Wrapper class?


A Wrapper class is a class whose instances are collection of other objects.
It is used to display different objects on a Visual Force page in same table.

Q. What is Difference between SOQL and SOSL?


SOQL(Salesforce Object Query Language)
Using SOQL we can Search only on one object at a time.
We can query on all fields of any datatype
We can use SOQL in Triggers and classes.
We can perform DML operation on query results.
SOSL(Salesforce object Search Language)
Using SOSL we can search on many objects at a time.
We can query only on fields whose data type is text,phone and Email.
We can use in calsses but not in Triggers.
We cannot perform DML operation on search result

Q. What is difference insert() and database .insert() ?


Using insert method we can insert the records but if any error occurs in any record system will throw an error insertion
fail and none of the records are inserted.
If we want to execute partially success of bulk insert operation we will use database .insert.
Q. What is Static Resources?
Using Static Resources we can upload images, zip files, jar files, java script and CSS files that can be referred in a
visual force page.
The maximum size of Static Resources for an organization is 250mB.

Q. How to call java script using Static Resource in Visual Force page?
Add java script file in Static Resource setup -> develop -> Static Resources -> click on ‘New’ -> Name: filename and
add file from local desktop and save.
We can use that file as follows in Visual Force page
<apex: includescript values=” {! $Resource.fileName}”/>

Q. What is sharing rule?


If we want to give the access to other users we use sharing rules.

Q. How many ways we can share a record?


Role Hierarchy:
If we add a user to a role, the user is above in the role hierarchy will have read access.
Setup -> manage users -> roles -> setup roles -> click on ‘add role’ -> provide name and save.
OWD:
Defines the base line setting for the organization.
Defines the level of access to the user can see the other user’s record
OWD can be Private, Public Read Only, Public Read and Write.
Setup -> Security Controls -> sharing settings -> Click on ‘Edit’
Manual Sharing:
Manual Sharing is sharing a single record to single user or group of users.
We can see this button detail page of the record and this is visible only when OWD setting is private.
Criteria Based Sharing rules:
If we want to share records based on condition like share records to group of users
Whose criteria are country is India.
Setup -> security controls -> sharing settings -> select the object and provide name and
Conditions and save
Apex sharing:
Share object is available for every object(For Account object share object is AccountShare ). If we want to share the
records using apex we have to create a record to the share object.
Q. Unit testing code which has logic around the CreatedDate
You can create sObjects in memory with arbitrary CreatedDate values by using JSON.deserialize. This doesn’t
enforce the normal read-only field attributes that prevent you from setting a createdDate value. However you can’t
commit arbitrary CreatedDate values to the database (or else it would be a serious security issue).
An example of doing so :
String caseJSON = ‘{“attributes”:{“type”:”Case”,”url”:”/services/data/v25.0/sobjects/Case/500E0000002nH2fIAE”},
“Id”:”500E0000002nH2fIAE”,
“CreatedDate”:”2012-10-04T17:54:26.000+0000″}’;
Case c = (Case) JSON.deserialize(caseJSON, Case.class );
System.debug(c.createdDate);
Note that I built the caseJSON string by creating a test case and serializing it, which is the easiest way to get JSON
similar to what you want, then you can just tweak the values.

Q. Ignoring Validation rules when deploying code


I have seen a solution that uses a Custom Setting of ValidationRuleEnabled.
ALL validation rules set up have the && $Setup.CustomSetting__c.ValidationRuleEnabled__c added.
When you want to deploy any code then the administrator changes the Custom Setting to FALSE, deploy the new
code; don’t forget to re-enable the Custom Setting!
Again this is not ideal as the ‘legacy’ code should be updated to accommodate the new validation rules; ideally at the
time of creating the new validation rules (but who checks code coverage after making a small change like a validation
rule?)

Q. Can I find out if the current user has access to a record without querying?
To find out if a particular user has Edit access to a record, use the UserRecordAccess object. This object is available
in API version 24.0 and later. You can use SOQL to query this object to find out if the user has edit access to the
record in question.
SELECT RecordId, HasEditAccess FROM UserRecordAccess WHERE UserId = [single ID] AND RecordId = [single
ID]
If you want to check a batch of records you can use
SELECT RecordId FROM UserRecordAccess WHERE UserId=:UserInfo.getUserId()
AND HasReadAccess = true ANDRecordId IN :allRecordIds LIMIT 200
But make sure that allRecordIds is a LIST of IDs. It doesn’t work if allRecordIds is a SET of IDs. I guess that’s a bug.
Also, only a maximum amount of 200 recordIds can be checked in one query.

Q. Detecting governor limits through apex


First of all, the exception thrown by hitting a limit, System.LimitException is uncatchable and means that your script
will be killed, even if it happens inside a try/catch block. There is a class, Limits, that contains a number of static
methods that allow you to check your governor limit consumption,
see: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_limits.htm
With that said, your example of @future calls per day is one of the limits that simultaneously is and isn’t a governor
limit as I believe it throws a System.AsyncException instead which is not catchable, and kills your script as a
LimitException would.

Q. What is a concise function that formats a (String) decimal into a currency format in Apex?
@RickMeasham’s method is a good one, but I ran into a couple rounding issues with negative values and fractional
values. Here’s my edited version of the method that passes the tests I needed it to (not rendering -0.001 as “-0.00”,
not rendering -1.10 as “-1.09”).
public static String formatCurrency(Decimal i) {
if (i == null || Math.abs(i) < 0.005) return ‘$0.00’;
String s = (i.setScale(2) + (i >= 0 ? 0.001 : -0.001)).format();
return s.substring(0, s.length() – 1);
}
(EDIT: changed “<= 0.005” to “< 0.005” per @RickMeasham’s advice below.)
(EDIT 2: actually realized, when I finished tests, that this updated method still had a few shortcomings related to
rounding. I updated to delegate to Math.roundToLong per code below [which uses round half even, not half up as I
stated in my comments erroneously]. It now passes all my unit tests, which you can see
here: http://codepad.org/ycttSXjq)
private String formatCurrency(Decimal i) {
if (i == null) return ‘0.00’;
i = Decimal.valueOf(Math.roundToLong(i * 100)) / 100;
String s = (i.setScale(2) + (i >= 0 ? 0.001 : -0.001)).format();
return s.substring(0, s.length() – 1);
}

Q. How do you write a unit test for a trigger whose only function is to make a callout?
Both future methods and callouts can be unit tested.
To test future methods simply make your call to any future method
between Test.startTest();and Test.stopTest(); statements and the future method will return when Test.stopTest(); is
called. See the documentation for the Test class here: System.Test
Testing callouts is a bit trickier though. Basically in your callout code you check to see if you’re executing within a unit
test context by checking Test.isRunningTest() and instead of getting your callout response from
an HttpResponse.send() request, you return a pre-built test string instead. There’s one example of this method
here: http://www.iterativelogic.com/unit-test-callouts-in-apex-code-part-2/
There’s also an older example of callout unit testing that uses a static variable you set in your unit test. Just replace
that static variable with a call to Test.isRunningTest() and their example works fairly well as well. That example can
be found here:http://sfdc.arrowpointe.com/2009/05/01/testing-http-callouts/

Q. Can report data be accessed programmatically?


Update for Winter ’14
API:
I think the biggest announcement that developers have been waiting for API wise is the availability of our Analytics
API. We introduced a limited pilot in summer 13 and now the Analytics REST API is generally available. The Analytics
API lets you integrate Salesforce report data into your apps programmatically and has several resources that let you
query metadata, and record details.
Source – Winter 14 Developer Preview

Q. How do you unit test a trigger when you don’t know the required fields?
Customers can have validation on custom fields via validation rules and triggers, so handling that in your unit tests
without customer intervention is next to impossible. The first step to reducing issues is to have your test data populate
all standard fields and ensure the data uses the most common formatting for your customer base (US style phone
numbers and addresses for the US for example).
Beyond that you can use the new Reflection features added to Salesforce in Summer ’12 to allow customers to create
unit test data classes that can be used by your managed package. Basically you define a test data generation interface
and the customer creates an Apex class to generate data for you. Here’s an example of using Reflection in a similar
manner on the DeveloperForce blog:http://blogs.developerforce.com/developer-relations/2012/05/dynamic-apex-
class-instantiation-in-summer-12.html
Using the method for unit tests run on install might be problematic as you’d have to have the customer create the
class before they install your package and your package could only look for the class by name (or iterate through all
default namespace classes and check for the correct interface). However, it’s no longer necessary for unit tests to run
during installation for managed packages and by default they do not.
The Reflection method requires some coding knowledge on the customer side, but you could add a tool in your
application to generate the custom unit test data class for the customer.
FYI, it’s no longer necessary for managed package unit tests to succeed in customer orgs. They’re not required on
install, they will no longer prevent deployment to production and they don’t count as part of the customers unit test
coverage percentage for purposes of deployment. The only exception to that is if the customer uses ANT and sets
the runAllTests parameter to true.

Q. Deleting a class without IDE


This can be done with the Force.com Migration Tool:http://wiki.developerforce.com/page/Force.com_Migration_Tool
See the full documentation here: http://wiki.developerforce.com/page/Force.com_Migration_Tool
The tool can create or delete any meta-data that can be created through the Force.com IDE or Change Sets. It comes
with a sample config file that contains example deployments for deploying objects and Apex code and deleting them
as well. The documentation has a very detailed step-by-step guide here:
http://www.salesforce.com/us/developer/docs/daas/index_Left.htm#StartTopic=Content/forcemigrationtool.htm

Q. Is there a defacto 3rd party utilities library for Apex such as Apache Commons is for Java?
Apex-lang is about as close to a Java-style library as you can get. Contains several string, database, and collection
utilities that mimmick Java functionality. Be aware though, some stuff including Comparing and Sorting collections is
out of date with the advent of the Comparable interface in Apex.
In addition to apex-lang, and like you suggest, I typically create or reuse static helper methods throughout my projects.
Static helper methods are very convenient for reusing code in Chatter functionality, DML handling, Exception handling,
Unit testing, etc.

Q. Using transient keyword to store password in hierarchy custom setting


Because your myPref property is transient the initialisation you perform in the constructor won’t round trip when the
page posts back.
When I’ve used transient and a protected custom setting I use separate properties that are transient and then only
work with the custom setting in the post back method.
Controller
Skip code block
public with sharing class TestCustomSettings {
// transient to ensure they are not transmitted as part of the view state
public transient String password1 {get; set;}
public transient String password2 {get; set;}
public PageReference save() {
// I’ve changed this to getInstance() rather than getValues()
TestR__c myPref = TestR__c.getInstance(UserInfo.getOrganizationId());
if(myPref == null) {
myPref = new TestR__c();
myPref.SetupOwnerId = Userinfo.getOrganizationId();
}
myPref.Password1__c = password1;
myPref.Password2__c = password2;
// Note that by using upsert you don’t need to check if the Id has been set.
upsert myPref;
}
}
Visualforce page
You can use inputSecret rather than inputField in the Visualforce page so that the browser will mask the input.
<apex:inputSecret value=”{!password1}” size=”10″/>
<apex:inputSecret value=”{!password2}” size=”10″/>

Q. Is there a way to setup continous integration for apex tests?


There are a couple of decent Dreamforce presentations here: Team Development: Possible, Probable, and
Painless and Continuous Integration in the Cloud.
We ran into some issues with this in practice and there was no way to get true automation (i.e., set it and forget it).
We were also setting it up with Selenium.
Here were the issues that I remember.

1. Some features aren’t supported in the metadata API and cannot be moved via the ant migration. If you have any unit
tests that work with those features, you have to manually work on your CI org.
2. Deletions are harder to maintain. You have to manually update and apply a destructiveChanges.xml file or replicate
the deletion in the CI org.
3. We ran into a situation where some metadata XML files had ‘invalid’ data in them. The suggested solution was to build
a post checkout script that manipulates the offending XMLs into valid XMLs. Not ideal.
4. On projects, we wanted to track just our changes and push out just our changes in source control. In theory, this would
allow much easier rebaselining. This would have required more manual maintenance of XML files (e.g., 2 new fields
added on Account and only want to push those 2 fields not all (*) fields).
My conclusion is that it is worth doing if you can get it set up, but if you are working on shorter term projects and don’t
have a decent amount of time budgeted in for it, it probably isn’t worth setting up.
Although it isn’t CI, check out http://developer.force.com/cookbook/recipe/automated-unit-test-execution. You could
set it up to run every hour or something like that.

Q. What are the implications of implementing Database.Stateful?


Daniel Ballinger: No, batches do not ever run simultaneously. You are correct, however, that serialization is the culprit
here.
grigriforce: what’s your batch size? If you’re doing a million records, and your batch size is 1, then you will
serialize/deserialize your state 1M times. Even with a small serialized object, that’s gonna hurt.

Q. What are the recommended ways to refactor in Apex?


I use the second method. After refactoring, I select the ‘src’ folder, use File Search/Replace and all the changes are
made and saved to the server in one go.

Q. What is a good set of naming conventions to use when developing on the Force.com
platform?
Follow the CamelCase Java conventions, except for VF pages and components start with a lower case letter.
Triggers:

 <ObjectName>Trigger – The trigger itself. One per object.


 <ObjectName>TriggerHandler – Class that handles all functionality of the trigger
 <ObjectName>TriggerTest
Controllers:

 <ClassName>Controller
 <ClassName>ControllerExt
 <ClassName>ControllerTest
 <ClassName>ControllerExtTest
Classes:

 <ClassName>
 <ClassName>Test (These might be Util classes or Service classes or something else).
Visualforce pages and components:
 <ControllerClassName>[optionalDescription] (without the suffix Controller). There might be multiple views so could
also have an extra description suffix.
Object Names and custom Fields

 Upper_Case_With_Underscores
Variables/properties/methods in Apex

 camelCaseLikeJava – more easily differentiated from fields


Test methods in test classes

 test<methodOrFunctionalityUnderTest><ShortTestCaseDesc> – For example,


testSaveOpportunityRequiredFieldsMissing, testSaveOpportunityRequiredFieldsPresent, etc.
Working on something that would be used as an app or in some cases just a project? If yes, then do the following:
Prefix all custom objects, apex classes, Visualforce pages and components with an abbreviation so that they are
easier to identify (e.g., easier for changesets). For example the WidgetFactory app would have the prefix wf on those.
Additionally, when adding custom fields to a standard object they would also be prefixed to identify them as part of
the app/package.
The main reason for the Object and Fields Names using Upper_Case_With_Underscores is that when you type in the
name field or object with spaces it automatically adds the underscores. Although Apex is case insensitive, always
refer to the Objects and Custom Fields in the code as Upper_Case_With_Underscores as well for consistency all
around and consistency with what is generated by the SOQL schema browser and other tools. Object and
Field Labels (which are generally ignored by code but visible to users) should keep spaces, not underscores.

Q. Why use Batch Apex?


A Batch class allows you to define a single job that can be broken up into manageable chunks that will be processed
separately.
One example is if you need to make a field update to every Account in your organization. If you have 10,001 Account
records in your org, this is impossible without some way of breaking it up. So in the start() method, you define the
query you’re going to use in this batch context: ‘select Id from Account’. Then the execute() method runs, but only
receives a relatively short list of records (default 200). Within the execute(), everything runs in its own transactional
context, which means almost all of the governor limits only apply to that block. Thus each time execute() is run, you
are allowed 150 queries and 50,000 DML rows and so on. When that execute() is complete, a new one is instantiated
with the next group of 200 Accounts, with a brand new set of governor limits. Finally the finish() method wraps up any
loose ends as necessary, like sending a status email.
So your batch that runs against 10,000 Accounts will actually be run in 50 separate execute() transactions, each of
which only has to deal with 200 Accounts. Governor limits still apply, but only to each transaction, along with a separate
set of limits for the batch as a whole.
Disadvantages of batch processing:

 It runs asynchronously, which can make it hard to troubleshoot without some coded debugging, logging, and persistent
stateful reporting. It also means that it’s queued to run, which may cause delays in starting.
 There’s a limit of 5 batches in play at any time, which makes it tricky to start batches from triggers unless you are
checking limits.
 If you need access within execute() to some large part of the full dataset being iterated, this is not available. Each
execution only has access to whatever is passed to it, although you can persist class variables by implementing
Database.stateful.
 There is still a (fairly large) limit on total Heap size for the entire batch run, which means that some very complex logic
may run over, and need to be broken into separate batches.
Q. Documenting Salesforce.com Apex class files
I have used apexDoc for a while and we are starting to roll it out more fully for our use at my organisation. It is open

source software and so you could always contribute some updates for it What features are you wanting
to add to it that it doesn’t have (just to give a flavour)?
In answer to your questions
1) I don’t think anybody has successfully managed to do this. There is an idea of the ideas exchange for it to
be done but it seems to gain very little support.
2) Theoretically it should be pretty easy as apex is a Java DSL. Have you tried running Doxygen and if so what errors
does it throw up?
3) I use ApexDoc to generate some basic output and then have a little script tied in to copy across custom css and
things. It isn’t perfect but it does for the small amount we need at the moment.
I believe the IDE is being open sourced at some time in which case I would imagine the antlr grammar file would
become available which may help you out.
I know it is not really an answer for what you wanted to hear per se, but sadly it’s all we have atm (and I would love a
nicer documentation generator!!)
Paul

Q. Workarounds for Missing Apex Time.format() Instance Method


You could just split the DateTime format() result on the first space – does that give you what you’re looking for?
public String myDateFormat(DateTime dt) {
String[] parts = dt.format().split(‘ ‘);
return (parts.size() == 3) ? (parts[1] + ‘ ‘ + parts[2]) : parts[1];
}
produces
6:38 PM
for me in English (United States), and
18:42
in French(France).
UPDATE
As tomlogic points out, the above method is not very robust – some locales may include spaces in the date or time
portion of the format, and the ordering is not consistent. This second attempt assumes that the date and time are
separated by zero or more spaces, but handles spaces within the two portions, and either ordering of date and time.
The only assumption made is that the formatted Date is contained within the formatted Time:
public String myDateFormat(DateTime dt) {
return dt.format().replace(dt.date().format(), ”).trim();
}
Seems to work fine for Hebrew, Vietnamese & Korean, as well as English and French.
Q. Is there an average method for apex math
Unfortunately the standard math methods only include simpler operations (i.e. those that work on a single, or two
values), so it looks as though you’ll have to roll your own method.
Of course the number of script statements executed will be proportional to the length of the list, so of the lists are ever
of a fixed size it could be worth using a macro to generate the addition part for you:
Int sum = i[0] + i[1] + … i[n];
Doing so would only count for one statement, but you’ll only need this if governor limits are of concern which is often
not a worry.
If govenor limits aren’t an issue you could create a function along these lines:
Skip code block
Integer[] myInts = new Integer[]{1, 2, 3, 4, 5, 6, 7};
Integer total = 0;
Double dAvg;
for (Integer i : myInts) {
total += i;
}
dAvg = Double.valueOf(total) / myInts.size();
return dAvg;

Q. Grammar for creating an Apex parser


Keep an eye on Apex tooling api, which is used in Developer console. This is supposed to be released to public
access soon.

Q. Does ‘default value’ do anything if the object is created through Apex?


New feature coming in the next release:
Foo__c f = Foo__c.sobjecttype.newSObject(
recordTypeId, // can be null
true); // loadDefaultValues

Q. Detect the current LoggingLevel in Apex


Unfortunately, I don’t think there is a way to check the current logging level in APEX.

Q. Call Apex class method on the fly (dynamically)


While you can instantiate a class based on its name using the Type system class, you can’t dynamically locate a
method and execute it. The best that you can do is to dynamically create an instance of a class that implements an
interface and execute one of the methods on the interface.
There’s more information on the Type class and an example in the :
Apex Developer’s Guide

Q. SOQL – query a query


It sounds like you’re talking about using nested SOQL queries. Here’s an example of querying a parent and two child
objects in one query, using the relationship name for each related list of objects:
list<Account> accswithchildren = [select Id, Name, CreatedDate,
(select Id, CreatedDate from Tasks order by CreatedDate desc limit 1),
(select Id, Service_Date__c from Custom_Object__r order by Service_Date__c desc limit 1)
from Account where Id in :setofids];
You can then loop through those Accounts in Apex, and for each one, there is a list (size 0 or 1) of Tasks and
Custom_Object__c:
for (Account a : accswithchildren)
{
list<Task> theseTasks = a.Tasks;
list<Custom_Object__c> otherobjects = a.Custom_Object__r;
//do something with these records
}

Q. What’s the best way to check if person accounts are enabled via Apex Code?
I’ve found two methods to accomplish this.
Method 1
Try to access the isPersonAccount property on an Account and catch any exception that occurs if that property is
missing. If an exception is generated then person accounts are disabled. Otherwise they’re enabled. To avoid making
person accounts required for the package you assign the Accountobject to an sObject and use sObject.get(
‘isPersonAccount’ ) rather than accessing that property directly on the Account object.
This method takes ~3.5ms and negligible heap space in my testing.
Skip code block
// Test to see if person accounts are enabled.
public Boolean personAccountsEnabled()
{
try
{
// Try to use the isPersonAccount field.
sObject testObject = new Account();
testObject.get( ‘isPersonAccount’ );
// If we got here without an exception, return true.
return true;
}
catch( Exception ex )
{
// An exception was generated trying to access the isPersonAccount field
// so person accounts aren’t enabled; return false.
return false;
}
}
Method 2
Use the account meta-data to check to see if the isPersonAccount field exists. I think this is a more elegant method
but it executes a describe call which counts towards your governor limits. It’s also slightly slower and uses a lot more
heap space.
This method takes ~7ms and ~100KB of heap space in my testing.
// Check to see if person accounts are enabled.
public Boolean personAccountsEnabled()
{
// Describe the Account object to get a map of all fields
// then check to see if the map contains the field ‘isPersonAccount’
return Schema.sObjectType.Account.fields.getMap().containsKey( ‘isPersonAccount’ );
}

Q. Can’t Deploy Due to Errors in 3rd Party Packages


It was previously possible to install managed packages and Ignore APEX Test Errors this isn’t the case anymore.
Your probably going to have to uninstall them if you want to deploy from Sandbox to production, and reinstall them.
If it’s Milestones PM (the package) is you can probably get an unmanaged version to work with and fix the bugs.
UPDATE
Looks like you are using the unmanaged package. So I think if you don’t want to uninstall before going to production
your going to have to fix those errors manually by fixing the code.
Unfortunately, SFDC test methods don’t live in a complete vacuum where you can run tests against your org without
bumping other code, even when you go to deploy.

Q. How Can I Tell the Day of the Week of a Date?


Formulas
There isn’t a built-in function to do this for you, but you can figure it out by counting the days since a date you know.
Here’s the concept: I know that June 29, 1985 was a Saturday. If I’m trying to figure out the day of the week of July 9
of that year, I subtract the dates to determine the number of days (10), and then use modular division to figure to
remove all the multiples of 7. The remainder is the number of days after Saturday (1 = Sunday, 2 = Monday, etc.) and
you can use that number in your logic:
MOD(DATEVALUE( Date_Field__c ) – DATE(1985,7,1),7)
Apex Code
You could do the same thing with time deltas, but you can also use the poorly documentedDateTime.format() function:
// Cast the Date variable into a DateTime
DateTime myDateTime = (DateTime) myDate;
String dayOfWeek = myDateTime.format(‘E’);
// dayOfWeek is Sun, Mon, Tue, etc.
Q. What is App in Sales force?
An app is a group of tabs that work as a unit to provide functionality. Users can switch between apps using the
Force.com app drop-down menu at the top-right corner of every page.
You can customize existing apps to match the way you work, or build new apps by grouping standard and custom
tabs.
Navigation to create app in Sales force: Setup ->Build ->Create->App-> Click on new and create your application
according to your requirements.

Q. What is object in Sales force?


Custom objects are database tables that allow you to store data specific to your organization in salesforce.com. You
can use custom objects to extend salesforce.com functionality or to build new application functionality.
Once you have created a custom object, you can create a custom tab, custom related lists, reports, and dashboards
for users to interact with the custom object data. You can also access custom object data through the Force.com API.
Navigation to create object in sales force: Setup->Build->Create->Object-> Click on new object and create object
according to your requirement.

Q. How many relationships included in SFDC & What are they?


We are having two types of relationships, they are
Lookup Relationship
Master-Detail Relationship

Q. What is a “Lookup Relationship”?


This type of relationship links two objects together,
Up to 25 allowed for object
Parent is not a required field.
No impact on a security and access.
No impact on deletion.
Can be multiple layers deep.
Lookup field is not required.

Q. What is “Master-Detail Relationship”?


Master Detail relationship is the Parent child relationship. In which Master represents Parent and detail represents
Child. If Parent is deleted then Child also gets deleted. Rollup summary fields can only be created on Master records
which will calculate the SUM, AVG, MIN of the Child records.
Up to 2 allowed to object.
Parent field on child is required.
Access to parent determines access to children.
Deleting parent automatically deletes child.
A child of one master detail relationship cannot be the parent of another.
Lookup field on page layout is required.

Q. How can I create Many – to – Many relationship?


Lookup and Master detail relationships are one to many relationships. We can create many – to – Many relationship
by using junction object. Junction object is a custom object with two master detail relationships.

Q. 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?
No, directly we cannot create master details relationship if custom object contains existing records.
Following are the steps to create to create master-detail relationship when records are available in custom object.

1. First create field with lookup relationship.


2. And then associate look field with parent record for every recordNext change the data type of the field from look up to
Master detail.

Q. List examples of custom field types?


Text, Pick list, Pick list (multi select), Date, Email, Date/Time, Date, Currency, Checkbox, Number, Percent, Phone,
URL, Text Area, Geolocation, lookup relationship, master detail relationship etc…..

Q. What is TAB in Salesforce?


Tab is a user interface component to user creates to display custom object data.
There are three type of tabs.
Custom Tabs
Visual force Tabs
Web Tabs

Q. What are the actions in workflow?

1. Email Alert
2. Task
3. Field Update
4. Outbound Message
Go through the below link for the more information about workflow
actions HTTP://WWW.SALESFORCETUTORIAL.COM/SALESFORCE-WORKFLOW-AUTOMATION-
WORKFLOW-MANAGEMENT/

Q. How many ways we can made field is required?

1. While creation of field


2. Validation rules
3. Page Layout level

Q. What is difference between Role and Profile?


Role is Record level access and it is not mandatory for all users.
Profile is object level and field level access and it is mandatory for all users.

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

Q. How many controllers can be used in a visual force page?


Salesforce come under SAAS so, we can use one controller and as many extension controllers.

Q. What is difference between Action support and Action function?


Action function: Invoke the controller method from java script using AJAX and we can use action function from
different places on visual force page.
Action support: Invoke the controller method using AJAX when even occurs on page like onMouseOver, onClick, ect…
and we can use action support for particular single apex component.

Q. How many ways we can call the Apex class?

1. Visual force page


2. Web Service
3. Triggers
4. Email services
Q. How to create Master Details relationship between existing records?
Directly we can’t create Master Detail relationship between existing records, first we have to create Lookup relationship
and provide valid lookup fields and it shouldn’t null.

Q. What is permission set?


Permission sets extend user’s functional access without changing user’s profile.
Ex: A user has only read access through profile on custom object, administrator want to give access Edit and create
operations to him without changing the profile. Administrator creates the permission set having edit and creates
operation on custom object and assign to that user.

Q. What is manual sharing?


Manual sharing is to share a record to a particular user manually.
Go to detail page of record and click on manual sharing button and assign that record to other user with Read or
Read/Write access.
Manual Sharing button enables only when OWD is private to that object.

Q. How we can change the Grant access using role hierarchy for standard objects?
Not possible.

Q. What is the use of “Transfer Record” in profile?


If user have only Read access on particular record but he wants to change the owner name of that record, then in
profile level Transfer Record enables he can able to change the owner.

Q. What is Field dependency?


According to the field selection on one field filter the pick list values on other field.

Q. Is check box performs like controlling field?


Yes possible. Controlling field should be Check box or pick list.

Q. How many field dependencies we can use in Visual Force page?


Maximum we can use 10 field dependencies in VF page.

Q. What is Roll-up summary?


Roll-up displays the count of child records and calculate the sum, min and max of fields of the child records.

Q. How to create Roll-up summary field on lookup relation?


Not possible. Roll-up summary is enabled for only Master –Detail relationship.

Q. What are the Record Types?


Record Types are restrict the pick list values and assign to the different page layouts for different Record Types.

Q. What is Audit Trail?


Audit Trail provides the information or track all the recent setup changes that an administrator done to the organization.
This can store the last 6 months data.

Q. What are the Report Types?


4 Types of report in Salesforce
Tabular Reports: We can only displays the grand total in the table form.
Summary Reports: It is a detail form of report in which the grouping done based on Columns.
Matrix Reports: It is a detail form of report in which the grouping done based on both Rows and Columns.
Joined Reports: We can join the two or more reports in the single report displayed in the form of blocks.

Q. What is Dashboard?
Dashboard is a pictorial representation of report. We can add up to 20 reports in single dashboard.

S-ar putea să vă placă și