A fresh batch of Salesforce online training is about to start. To apply for a demo, please send us an email at saaspillars@gmail.com or give us a call at +91 7386295856.
1. 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.
2. 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.
3. How many relationships included in SFDC & What are they?
We are having two types of relationships, they are Lookup Relationship Master-Detail Relationship
We are having two types of relationships, they are Lookup Relationship Master-Detail Relationship
4. What is a “Lookup Relationship”?
This type of relationship links two objects together,
Up to 40 allowed per object. Parent is not a required field.
No impact on security and access.
No impact on deletion.
Can be multiple layers deep.
Lookup field is not required.
5. 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.
6. 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.
7. 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 record
3. Next change the data type of the field from look up to Master detail.
8. List examples of custom field types?
Text, Pick list, Pick list (multi select), Date, Email, Date/Time, Currency, Checkbox, Number, Percent, Phone, URL, Text Area, Geolocation, lookup relationship, master detail relationship etc…..
9. 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
10. 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.
11. 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.
12. 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”.
13. 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).
14. 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.
15. 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.
16. 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
17. 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.
18. 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.
A single static resource can be up to 5 MB in size, and an organization can have up to 250 MB of static resources, total.
19. 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}”/>
20. What is sharing rule?
If we want to give the access
to other users we use sharing rules.
21. 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.
22. 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/
23. How many ways we can made field is required?
1. While creation of field
2. Validation rules
3. Page Layout level
24. 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.
25. What is the maximum size of the PDF generated on
visualforce attribute renderAs?
15MB
26. 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.
27. 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.
28. How many ways we can call the Apex class?
1. Visual force page
2. Web Service
3. Triggers
4. Email services
29. 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.
30. 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.
31. 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.
32. How we can change the Grant access using role hierarchy
for standard objects?
Not possible.
33. 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.
34. What is Field dependency?
According to the field selection on
one field filter the pick list values on other field.
35. Is check box performs like controlling field?
Yes possible. Controlling field should be Check box or pick list.
36. How many field dependencies we can use in Visual Force
page?
Maximum we can use 10 field dependencies in VF page.
37. 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.
38. How to create Roll-up summary field on lookup relation?
Not possible. Roll-up summary is enabled for only Master –Detail relationship.
39. What are the Record Types?
Record Types are restrict the pick list values and assign to the
different page layouts for different Record Types.
40. 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.
41. 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.
42. What is Dashboard?
Dashboard is a pictorial representation of report. We can add up to 20 reports
in single dashboard.
43. What is
the relationship between Contact and Account objects in salesforce?
In Salesforce, Contacts is having a look up relationship with
Accounts i.e., Simple relationship
44. What are different Organization
Wide Defaults? Explain each of them?
Below
are the different OWD values
Private
If the OWD for an object is set to
private, then only the owner, and users above that role in role hierarchy, can
view, edit and report on those records
Public
Read Only
If the OWD for an object is set to
Public Read Only, then all users can view and report on records but they cannot
edit them. Only the record owner and the users above that role in the role
hierarchy can edit the records
Public
Read/Write
If
the OWD for an object is set to Public Read/Write, then all users can view,
edit and report on all records. But only owner of the record can delete the
records.
Public Read/Write/Trfer
This is available only for Case and Lead objects
If
the OWD for an object is set to Public Read/Write/Trfer then, all users can
view, edit, trfer and report on all the records but only owner of the record
can delete the records
Public Full Access
This is available only for Campaign object.
If
the OWD for Campaigns are set Public Full Access then, all users can view,
edit, delete and report on all records.
No
Access, View Only or Use
This is available only for Price Book object.
If
the OWD for Price Book is set Use then, all users can access the Price Book
information and as well as using the Price Book configuration for Opportunities
with Products.
If
the OWD for Price Book is set View Only then, all users can access the Price
Book information but not to use that Price Book detail in Opportunities with
Products
If
the OWD for Price Book is set No Access then, it restricts users from accessing
information for Price Book and Prices.
Controlled
By Parent
If
the OWD for any object is set as Controlled By Parent, then user can perform an
action on the record based on whether they can do the same on the parent record
associated with it
45. Is it mandatory to select
User License while creating permission sets? If not, what is the significance
of selecting a User License?
It
is not mandatory to select a User License while creating a permission sets.
If
users with one type of license will use this permission set, then choose the
same license that’s associate with them.
If
you are planning to assign this permission set to multiple users with different
licenses then, choose none.
46. Can we create a new profile
without cloning an existing profiles?
No,
we have to clone any one of the existing profiles to create a new profile
47. Please explain the use of
Grant Access Using Hierarchies?
In
Sharing settings, OWD settings, we have a check box Grant Access Using
Hierarchies (for both standard and custom objects). If this check box is
checked then it will give automatic access to the user’s data to other users in
higher role of salesforce CRM Role Hierarchy.
If
this check box is not checked then, only record owner and users granted access
by OWD can gain the access.
49. What is
the batch size limit (increment size for batch) in Data Loader?
Data Loader batch size limit is maximum of 200 per increment
and if we selected Use Bulk API then maximum value is 10000
50. What is
the difference between Export and Export All in the context of Data Loader?
Export enables user to export all the records for a
particular object excluding the records in the recycle bin or soft deleted
records.
Export All enables user to export all the records for a
particular object including the records in the recycle bin or soft deleted
records.
51. What are the post refresh considerations?
1. New Organization ID is assigned to the refreshed sandbox
every time it is refreshed. Hence we need to replace the hard coded
organization id in our sandbox post refresh with newly created organization id.
2.To ensure the uniqueness, in all user records, user name will
be appended by sandbox name, if the resulting user name is not unique then,
second round of modification is performed to prepend the user name with alpa
numeric string to make sure the resulting username is unique.
3.The copy process does not copy contact data to developer and
configuration sandboxes. Therefore, customer portal users are not copied. These
customer portal users need to be created manually on need basis.
4. User email addresses are modified in sandbox to avoid sending
any mail from sandbox such as notifications triggered by workflows and
escalations rules.
5.Newly created sandboxes have the default email
deliverability setting System email only. We need to change this to All
Email.
6. If Server URL is hardcoded in the code, then we need to
replace it with the newly created URL
52.What is the storage limit of Full Copy,
Configuration Only and Developer sandboxes?
Full Copy Sandbox has the same storage limit as your production
organization
Configuration Only sandbox has the storage limit of 500MB
Developer Sandbox has the storage limit of 10MB
53. What is the interval of refreshing of Full Copy,
Configuration Only and Developer sandboxes?
Full Copy Sandbox can be refreshed once in 29 days
Configuration Sandbox can be refreshed once per day
Developer Sandbox can be refreshed once per day
54. What are the default sharing settings?
Default sharing settings are as follows
Controlled By Parent
Private
Public Read Only
Public ReadWrite
Public Read/Write/Trfer (Only for Case and Lead objects)
Public Full Access (Only for Campaign object)
Grant Access Using Hierarchies
Default sharing settings are as follows
Controlled By Parent
Private
Public Read Only
Public ReadWrite
Public Read/Write/Trfer (Only for Case and Lead objects)
Public Full Access (Only for Campaign object)
Grant Access Using Hierarchies
55. How many roles we can create for an organization?
We can create up to 500 roles for an organization
56. How many permission sets we can create for an
organization?
We can create up to 1000 permission sets for an organization
57. How many types of custom tabs are available in
salesforce?
There are 3 types of custom tabs are available in salesforce
1. Custom Object Tabs
2.Visualforce Tabs
3.Web Tabs
58. How many Master-Detail relationships is allowed for an
Object?
Each custom object can have up to two master-detail relationships
and up to 25 total relationships
59. How many criteria based sharing rules is allowed for an
Object?
Up to 50 criteria based sharing rules are allowed for an
object
60. How many days the deleted data will be reside in recycle
bin?
61. What are differences between custom settings and custom objects?
Custom Settings:
1. Custom settings are SOQL inexpensive
2. We can’t write triggers on custom settings
3. Fields on which we can create custom settings are restricted like picklists, lookups and formula fields can’t be created in custom settings
4. No Page layouts, record types, validation rules and workflow rules can be used on custom settings
Custom Objects:
1. Custom Objects are SOQL Expensive
2. We can have triggers on custom objects
3. No restrictions on creation of fields
4. Can be used on Custom objects
62. What are differences between workflows and approval process?
The key difference between workflows and approval process are as below
Workflow rules consist of single step and a single action where as approval process has multiple steps and different actions.
Workflow rules trigger automatically and the rules when triggered are not visible to the user. Approval process on the other hand, contains multiple step s each requiring a specific “I Approve or Reject” user action by the specified approvers.
63. What is the daily email alerts limit per standard salesforce license for workflow and approval process? And what is the overall daily organization limit?
Daily email alert for approval process and workflow are 1000 per standard salesforce license.
Overall daily organization limit for workflow and approval process email alert is 2000000 (2 million)
64. How many ways a field can be made mandatory?
A field can be made mandatory in 4 ways.
1. While creating a field, we can make it mandatory
2. Using Page Layouts
3. Using Triggers
4. Validation Rules
65. What are trigger best practices?
Trigger best practices include below things
1. Avoid DML, SOQLs in triggers
2. Have one trigger per object
3. Have a helper class to hold the logic of the trigger
4. Avoid recursion
66. What are the difference between 15 digit id and 18 digit id?
Difference between 15 digit ID and 18 digit ID is,
15 digit id is case sensitive
18 digit id is case insensitive
Last 3 characters of the 18 digit id represent the checksum of the capitalization of the first 15 digitss
67. What are different user licenses available in salesforce and explain them?
Below is the list of licenses available in salesforce
1) Salesforce Full access to salesforce CRM and appExchange
2) Salesforce Platform Access only to Custom apps but not standard CRM
3) Force.com One App Designed to access only one custom app with unlimited number of tabs
4) Force.com Knowledge Subscription Grant user access to Force.com Light app or Force.com enterprise app but no CRM functionality
5) Knowledge Only User Designed for users who only need access to the Salesforce Knowledge app
6) Chatter Free User has access to chatter which includes feeds, profiles, files and groups
7) Chatter External Designed to allow customers in Chatter groups. Customers are users outside of a company’s email domain.
8) Chatter Only User has access to Groups, feeds, people, profiles and files along with access to view accounts and contacts, modify custom objects and use CRM contents, Ideas and wers
68. What is traction workbench in salesforce?
Traction workbench is a salesforce feature for implementing the language in multiple languages. i.e not just the data but also all your configurations and customizations that you do as part of the implementation.
69. What is workbench in salesforce?
Workbench is a powerful, web-based suite of tools designed for administrators and developers to interact with salesforce.com organizations via the force.com APIs. Workbench includes robust support for the Force.com Partner, Bulk, Rest, Streaming, Metadata, and Apex APIs that allows users to describe, query, manipulate, and migrate both data and metadata in Salesforce.com organizations directly in their web browser with a simple and intuitive user interface
70. What is Data Loader and how many ways we can use Data Loader?
Data Loader is a client application, used for bulk import or export of data.
Data Loader can be used in 2 ways.
1. User Interface
2. Command Line
71. How many records we can insert using Data Loader?
We can insert up to 5 million records using Data Loader
72. What are the objects supported by Data Loader?
Data Loader supports all objects including custom objects
73. How often do Salesforce update the software?
The background software is typically updated thrice a year, Spring, Winter and Summer. Software updates are trparent to the user base and only require a small maintenance window over the weekend.
74. Can I have custom development within the Salesforce.com platform?
Yes, there are a number of different programming solutions available depending on the type of development required. There is the FORCE.COM development environment and typically Apex and Java languages that can be used.
75. Can I integrate my email from Outlook or other mail solutions?
Yes, there are a number of standard off the shelf tools that allow emails and contact information to be synchronized with data in Salesforce.com
76. How easy is it to customize the environment to reflect the way my business works?
It is relatively easy to configure the look and feel, add new fields, load up your company logo and change page layouts. You should always have a CRM strategy before you start and consider the impact of change on your data. If you have any concerns, our team of experts will happily help you!
77. How much space do I get with Salesforce?
All customers receive the default minimum storage amount of 1GB of data and 1GB of files.
Group Edition has 1GB of data and 1GB of file storage shared by all users. Professional and Enterprise Editions provide 20MB of data and 600MB of file storage per user.
Unlimited Edition provides 120MB of data and 600MB of file storage per user.
78. Where is my data being stored?
Depending on your geographical location, Salesforce.com will store your data in a number of hosted facilities in North America, Europe or the Asia Pacific.
79. How do I get my data back?
There are a number of tools and services that allow you to extract your data on going and at the end of the service contract. If you need a business continuity or Disaster Recovery plan, our trained Salesforce professionals will be please to help!
80. Are there Apps that perform different functions and services in Salesforce.com?
Yes, Salesforce has its own marketplace with currently over 1500 cloud computing and business applications to download and install.
Custom Settings:
1. Custom settings are SOQL inexpensive
2. We can’t write triggers on custom settings
3. Fields on which we can create custom settings are restricted like picklists, lookups and formula fields can’t be created in custom settings
4. No Page layouts, record types, validation rules and workflow rules can be used on custom settings
Custom Objects:
1. Custom Objects are SOQL Expensive
2. We can have triggers on custom objects
3. No restrictions on creation of fields
4. Can be used on Custom objects
62. What are differences between workflows and approval process?
The key difference between workflows and approval process are as below
Workflow rules consist of single step and a single action where as approval process has multiple steps and different actions.
Workflow rules trigger automatically and the rules when triggered are not visible to the user. Approval process on the other hand, contains multiple step s each requiring a specific “I Approve or Reject” user action by the specified approvers.
63. What is the daily email alerts limit per standard salesforce license for workflow and approval process? And what is the overall daily organization limit?
Daily email alert for approval process and workflow are 1000 per standard salesforce license.
Overall daily organization limit for workflow and approval process email alert is 2000000 (2 million)
64. How many ways a field can be made mandatory?
A field can be made mandatory in 4 ways.
1. While creating a field, we can make it mandatory
2. Using Page Layouts
3. Using Triggers
4. Validation Rules
65. What are trigger best practices?
Trigger best practices include below things
1. Avoid DML, SOQLs in triggers
2. Have one trigger per object
3. Have a helper class to hold the logic of the trigger
4. Avoid recursion
66. What are the difference between 15 digit id and 18 digit id?
Difference between 15 digit ID and 18 digit ID is,
15 digit id is case sensitive
18 digit id is case insensitive
Last 3 characters of the 18 digit id represent the checksum of the capitalization of the first 15 digitss
67. What are different user licenses available in salesforce and explain them?
Below is the list of licenses available in salesforce
1) Salesforce Full access to salesforce CRM and appExchange
2) Salesforce Platform Access only to Custom apps but not standard CRM
3) Force.com One App Designed to access only one custom app with unlimited number of tabs
4) Force.com Knowledge Subscription Grant user access to Force.com Light app or Force.com enterprise app but no CRM functionality
5) Knowledge Only User Designed for users who only need access to the Salesforce Knowledge app
6) Chatter Free User has access to chatter which includes feeds, profiles, files and groups
7) Chatter External Designed to allow customers in Chatter groups. Customers are users outside of a company’s email domain.
8) Chatter Only User has access to Groups, feeds, people, profiles and files along with access to view accounts and contacts, modify custom objects and use CRM contents, Ideas and wers
68. What is traction workbench in salesforce?
Traction workbench is a salesforce feature for implementing the language in multiple languages. i.e not just the data but also all your configurations and customizations that you do as part of the implementation.
69. What is workbench in salesforce?
Workbench is a powerful, web-based suite of tools designed for administrators and developers to interact with salesforce.com organizations via the force.com APIs. Workbench includes robust support for the Force.com Partner, Bulk, Rest, Streaming, Metadata, and Apex APIs that allows users to describe, query, manipulate, and migrate both data and metadata in Salesforce.com organizations directly in their web browser with a simple and intuitive user interface
70. What is Data Loader and how many ways we can use Data Loader?
Data Loader is a client application, used for bulk import or export of data.
Data Loader can be used in 2 ways.
1. User Interface
2. Command Line
71. How many records we can insert using Data Loader?
We can insert up to 5 million records using Data Loader
72. What are the objects supported by Data Loader?
Data Loader supports all objects including custom objects
73. How often do Salesforce update the software?
The background software is typically updated thrice a year, Spring, Winter and Summer. Software updates are trparent to the user base and only require a small maintenance window over the weekend.
74. Can I have custom development within the Salesforce.com platform?
Yes, there are a number of different programming solutions available depending on the type of development required. There is the FORCE.COM development environment and typically Apex and Java languages that can be used.
75. Can I integrate my email from Outlook or other mail solutions?
Yes, there are a number of standard off the shelf tools that allow emails and contact information to be synchronized with data in Salesforce.com
76. How easy is it to customize the environment to reflect the way my business works?
It is relatively easy to configure the look and feel, add new fields, load up your company logo and change page layouts. You should always have a CRM strategy before you start and consider the impact of change on your data. If you have any concerns, our team of experts will happily help you!
77. How much space do I get with Salesforce?
All customers receive the default minimum storage amount of 1GB of data and 1GB of files.
Group Edition has 1GB of data and 1GB of file storage shared by all users. Professional and Enterprise Editions provide 20MB of data and 600MB of file storage per user.
Unlimited Edition provides 120MB of data and 600MB of file storage per user.
78. Where is my data being stored?
Depending on your geographical location, Salesforce.com will store your data in a number of hosted facilities in North America, Europe or the Asia Pacific.
79. How do I get my data back?
There are a number of tools and services that allow you to extract your data on going and at the end of the service contract. If you need a business continuity or Disaster Recovery plan, our trained Salesforce professionals will be please to help!
80. Are there Apps that perform different functions and services in Salesforce.com?
Yes, Salesforce has its own marketplace with currently over 1500 cloud computing and business applications to download and install.
81. What is the difference between Customer portal and Partner portal?
Traditionally Partner Portal is part of companies Partner Channel Sales efforts. It is a portal focused more on Sales force automation and the efforts of those partners that sell your products to nurture the leads you pass to them, the leads they enter in themselves and the convert to Opportunity and subsequent sale.
Customer Portal on the other hand is more focused on the Service and Support of one’s Customers.
The feature differences are that Partner Portal exposes the Leads and Opportunity objects whereas the Customer Portal does not. However, only the top tier of Partner licensing (Gold Partner licenses) exposes the Case object whereas this is standard in the Customer Portal.
82. Give one example where you will use a trigger instead of a workflow?
Workflow allows us to perform certain operation on only one object but if we required performing operations/tasks/updates on multiple objects then we use trigger instead of workflows.
83. Explain the lead conversion process in salesforce?
When you convert a lead, the standard lead fields are automatically converted to the new account, contact, and, optionally, an opportunity using the information from the lead.
Custom lead fields are converted to custom account, contact, and opportunity fields as specified by your administrator.
All open and closed activities from the lead are attached to the account, contact, and opportunity.
84. Dashboards cannot be created on which kind of Reports?
Dashboard cant be created using Tabular reports. (If we specify row limit, we can create dashboards using tabular reports also)
85. What is the difference between Task and Events?
An event is a calendar event scheduled for a specific day and time.
Examples of events are:
1) Meetings
2) Scheduled Conference Calls
A task is an activity not scheduled for an exact day and time. You can specify a due date for a task or there may not be a particular time or date that the tasks or activities need to be completed by.
Examples of tasks are:
1) A list of phone calls you need to make.
2) An email that needs to be sent.
86. What are person accounts?
A person account is an individual consumer with whom you do business, such as a financial services client, an online shopper, or a vacation traveler. Person accounts are applicable to organizations that operate on a business-to-consumer model as opposed to a business-to-business model.
87. What are system fields? Can you name some of them?
System fields are read-only fields found on most objects. These fields are automatically updated during API operations
Examples are, Id, IsDeleted, CreatedById , CreatedDate , LastModifiedById , LastModifiedDate and SystemModstamp
88. What is mini page layout?
A mini page layout contains a subset of the items in an existing page layout. Mini page layouts inherit record type and profile associations, related lists, fields, and field access settings from their associated page layout
89. What is Customer Relationship Management (CRM)?
Customer Relationship Management (CRM) and Customer Experience Management (CEM) are about ensuring that your customers receive the best possible service from your organization. It is the drawing together of all the resources within your business to work for your customer to maximize your value to your their business.
90. Do I need to install anything on my workstation(s) to use Salesforce.com?
No! You can start using Salesforce.com through any web browser; however some extended functionality requires you to use Microsoft Internet Explorer because features such as mail merging from Salesforce.com to create a Word document require the installation of a small ActiveX plugin.
91. What happens if I find a fault in Salesforce.com?
Salesforce.com incorporates an extensive help and 'how do I do that' system that is fully searchable. If you can't find an wer there why not ask one of our experts?
92. Can I use my existing applications in conjunction with Salesforce.com?
Salesforce.com comes with a number of tools for integrating it with applications such as Word, Excel and Outlook. There is also a large pool of custom written paid for Apps and Plugins available at the 'Salesforce AppXchange. Further to this some versions of Salesforce,com provide access to the Salesforce.com API and if you have access to the skills of a Developer he will be able to learn to write code that might for example get Salesforce.com functioning with an existing Microsoft SQL Database.
93. What is a Lead?
A Lead is not yet a customer but any person or organization or company they may be interested in your company purchasing your product or using your services, you can import lead information into Salesforce by manually entering or importing from outside
94. What is a Contact?
A contact is any point of contact individual or influential directly associated with the account and possibly one or more opportunities. Information gathered about contact including name, phone number, address, position, and company and email information
95. Explain Lead conversion?
Lead can be converted in salesforce.com and the converted information is mapped to the appropriate business objects – Account, Contact or Opportunity
• The system automatically maps standard lead fields to standard account, contact, and opportunity fields
• For custom lead fields, your administrator can specify how they map to custom account, contact, and opportunity fields
• The system assigns the default picklist values for the account, contact, and opportunity when mapping any standard lead picklist fields that are blank. If your organization uses record types, blank values are replaced with the default picklist values of the new record owner.
• If the lead has a record type, the default record type of the new owner is assigned to records created during lead conversion.
96. What is a Web-to-Lead?
Web to Lead is an online form to capture lead information and this will be published on your website.
97. What is an Auto-Response Rule?
Auto response rules are rules configured to send an email/response to the users/group.
This determines which Email Template to send to cases generated via Web-to-Case
98. What is a Case?
Case is a logged issue or problem or Detail description of the problems, questions and feedback gathered from your customers.
Cases can be created by
• Manually entered from a phone call or an email
• Automatically create Case from an email (Email- to- Case)
• Automatically captured using Web site (Web-to-Case)
• Create a Case functionality in Outlook Edition
• May be assigned either manually or automatically via Assignment Rules
99. What is a Case Queue?
Case queue is a virtual storage bin that can be used to group cases based on criteria such as skill requirements, product categories, customer types, or service levels.
• Users have visibility into the Case Queues to which they are members
• Cases remain in the Queue until they are assigned to or taken by individual users
100. What is a Case Assignment Rule?
Case Assignment rules determines how Cases are automatically routed to User or Queue
Contains Rule Entries, pre-defined business rules that determine Case routing
Traditionally Partner Portal is part of companies Partner Channel Sales efforts. It is a portal focused more on Sales force automation and the efforts of those partners that sell your products to nurture the leads you pass to them, the leads they enter in themselves and the convert to Opportunity and subsequent sale.
Customer Portal on the other hand is more focused on the Service and Support of one’s Customers.
The feature differences are that Partner Portal exposes the Leads and Opportunity objects whereas the Customer Portal does not. However, only the top tier of Partner licensing (Gold Partner licenses) exposes the Case object whereas this is standard in the Customer Portal.
82. Give one example where you will use a trigger instead of a workflow?
Workflow allows us to perform certain operation on only one object but if we required performing operations/tasks/updates on multiple objects then we use trigger instead of workflows.
83. Explain the lead conversion process in salesforce?
When you convert a lead, the standard lead fields are automatically converted to the new account, contact, and, optionally, an opportunity using the information from the lead.
Custom lead fields are converted to custom account, contact, and opportunity fields as specified by your administrator.
All open and closed activities from the lead are attached to the account, contact, and opportunity.
84. Dashboards cannot be created on which kind of Reports?
Dashboard cant be created using Tabular reports. (If we specify row limit, we can create dashboards using tabular reports also)
85. What is the difference between Task and Events?
An event is a calendar event scheduled for a specific day and time.
Examples of events are:
1) Meetings
2) Scheduled Conference Calls
A task is an activity not scheduled for an exact day and time. You can specify a due date for a task or there may not be a particular time or date that the tasks or activities need to be completed by.
Examples of tasks are:
1) A list of phone calls you need to make.
2) An email that needs to be sent.
86. What are person accounts?
A person account is an individual consumer with whom you do business, such as a financial services client, an online shopper, or a vacation traveler. Person accounts are applicable to organizations that operate on a business-to-consumer model as opposed to a business-to-business model.
87. What are system fields? Can you name some of them?
System fields are read-only fields found on most objects. These fields are automatically updated during API operations
Examples are, Id, IsDeleted, CreatedById , CreatedDate , LastModifiedById , LastModifiedDate and SystemModstamp
88. What is mini page layout?
A mini page layout contains a subset of the items in an existing page layout. Mini page layouts inherit record type and profile associations, related lists, fields, and field access settings from their associated page layout
89. What is Customer Relationship Management (CRM)?
Customer Relationship Management (CRM) and Customer Experience Management (CEM) are about ensuring that your customers receive the best possible service from your organization. It is the drawing together of all the resources within your business to work for your customer to maximize your value to your their business.
90. Do I need to install anything on my workstation(s) to use Salesforce.com?
No! You can start using Salesforce.com through any web browser; however some extended functionality requires you to use Microsoft Internet Explorer because features such as mail merging from Salesforce.com to create a Word document require the installation of a small ActiveX plugin.
91. What happens if I find a fault in Salesforce.com?
Salesforce.com incorporates an extensive help and 'how do I do that' system that is fully searchable. If you can't find an wer there why not ask one of our experts?
92. Can I use my existing applications in conjunction with Salesforce.com?
Salesforce.com comes with a number of tools for integrating it with applications such as Word, Excel and Outlook. There is also a large pool of custom written paid for Apps and Plugins available at the 'Salesforce AppXchange. Further to this some versions of Salesforce,com provide access to the Salesforce.com API and if you have access to the skills of a Developer he will be able to learn to write code that might for example get Salesforce.com functioning with an existing Microsoft SQL Database.
93. What is a Lead?
A Lead is not yet a customer but any person or organization or company they may be interested in your company purchasing your product or using your services, you can import lead information into Salesforce by manually entering or importing from outside
94. What is a Contact?
A contact is any point of contact individual or influential directly associated with the account and possibly one or more opportunities. Information gathered about contact including name, phone number, address, position, and company and email information
95. Explain Lead conversion?
Lead can be converted in salesforce.com and the converted information is mapped to the appropriate business objects – Account, Contact or Opportunity
• The system automatically maps standard lead fields to standard account, contact, and opportunity fields
• For custom lead fields, your administrator can specify how they map to custom account, contact, and opportunity fields
• The system assigns the default picklist values for the account, contact, and opportunity when mapping any standard lead picklist fields that are blank. If your organization uses record types, blank values are replaced with the default picklist values of the new record owner.
• If the lead has a record type, the default record type of the new owner is assigned to records created during lead conversion.
96. What is a Web-to-Lead?
Web to Lead is an online form to capture lead information and this will be published on your website.
97. What is an Auto-Response Rule?
Auto response rules are rules configured to send an email/response to the users/group.
This determines which Email Template to send to cases generated via Web-to-Case
98. What is a Case?
Case is a logged issue or problem or Detail description of the problems, questions and feedback gathered from your customers.
Cases can be created by
• Manually entered from a phone call or an email
• Automatically create Case from an email (Email- to- Case)
• Automatically captured using Web site (Web-to-Case)
• Create a Case functionality in Outlook Edition
• May be assigned either manually or automatically via Assignment Rules
99. What is a Case Queue?
Case queue is a virtual storage bin that can be used to group cases based on criteria such as skill requirements, product categories, customer types, or service levels.
• Users have visibility into the Case Queues to which they are members
• Cases remain in the Queue until they are assigned to or taken by individual users
100. What is a Case Assignment Rule?
Case Assignment rules determines how Cases are automatically routed to User or Queue
Contains Rule Entries, pre-defined business rules that determine Case routing
101. What is Web-to-Case?
Web to Case is a method of capturing a problem/query from the customers. A web form that is published to a web site and Customers use to submit inquiries online
102. What is Email-to-Case?
Email to Case is a process of automatically creating a case when an email is sent to one of your
company’s email addresses.
103. What is an Escalation Rule?
Escalation rules are rules, automatically escalates an unresolved Case within a certain period of time (age over)
based on pre-defined business criteria
104. What are Business Hours?
Business hours are organization’s hours of operation
105. What is a Solution?
– An answer to a common question or problem
– Enables Customer Support users get up to speed quickly
– Enables Support teams to answer questions quickly and consistently
– Customers search for and browse published Solutions to selfassist
– Content-Rich Solutions are an enhancement to the Solution Object which allows solution writers to integrate rich text and
images into their solutions to completely solve a problem
What is a Category?
– Mechanism to organize Solutions
– Solutions may be associated to one or more Categories
– Categories make up a Solution Category tree structure
What are Suggested Solutions?
– The suggested solutions feature displays up to ten relevant solutions that may help users and customers solve a particular case from the case detail page and the Self-Service portal.
• Suggested Solutions can be enabled for the following:
Cases tab
Self Service Portal
Case auto-response rules and emails
106. What is the Self-Service Portal?
Self service portal is an authenticated portal which provides 24/7 online support and contains Public Knowledge Base, Suggested Solutions and Web-to-Case functionality
107. What is the AppExchange?
AppExchange is a Website Owned and Operated by salesforce.com which enables Partners and Customers to Download & Install Custom Apps and Components as per the need.
108. Jump Start Wizard vs. Standard Wizard ?
The Jump Start wizard creates a one-step approval process for you in just a few minutes
The Standard Wizard is useful for complex approval processes.
Jump Start Wizard
• The jump start wizard is useful for simple approval processes with a single step.
• Use the jump start wizard if you want to create an approval process quickly by allowing Salesforce to automatically choose some default options for you.
Standard Wizard
• The standard wizard is useful for complex approval processes.
• Use it when you want to fine tune the steps in your approval process.
• The standard wizard consists of a setup wizard that allows you to define your process and another setup wizard that allows you to define each step in the process.
109. Parallel Approval Routing ?
Parallel Approval Routing is sending approval requests to multiple approvers in a single step Wait for approval from all the approvers or wait for approval from any one
Configure an approval step to request approval from any combination of multiple users and related users
Configure 25 parallel approvers at each step
110. What is the Import Wizard?
Import Wizard is an easy-to-use multi-step wizard for importing new Accounts, Contacts, Leads, Custom Objects or Solutions. This is available only for System Administrators.
Import Wizard can be used or Account, Contact, Lead, Custom Objects or Solutions updates based on matching ID
Contact and Leads may be updated based on matching email address
Custom Objects or Solutions may be updated based on Custom Object names, Solutions titles, Salesforce ID or external ID
111. What is the input for Import Wizard?
We need to provide CSV file as a input to Import Wizard.
112. Explain Force.com Data Loader?
Force.com Data Loader is an application for the bulk import or export of data.
Data Loader is an easy-to-use wizard interface supports large files with up to millions of rows
Data Loader support for all objects, including custom objects
Use it to insert, update, delete, or extract, or upsert Salesforce records.
Force.com Data Loader can move data into or out of any salesforce.com object.
113. When to use Data Loader?
You need to load 50,000 or more records.
You need to load into an object that is not yet supported by web-based importing.
You want to schedule regular data loads, such as nightly imports.
You want to be able to save multiple mapping files for later use.
You want to export your data for backup purposes.
114. When to use web-based importing?
You are loading fewer than 50,000 records.
The object you need to import is supported by the web-based import wizards.
You want to prevent duplicates by uploading records according to account name and site, contact email address, or lead email address.
115. What is the Recycle Bin?
Recycle bin is a special folder provided by Salesforce,com, houses deleted data for approximately 30 days
Data can be recovered during this time period. Data stored in recycle bin is not counted against storage limit
If your organization reaches its Recycle Bin limit, Salesforce automatically removes the oldest records if
they have been in the Recycle Bin for at least two hours.
116. What are Trend Reports?
Trend reports are reports built on the data specified over a period.
117. What are Charts?
Charts are graphical representation of data of a single Summary or Matrix Report
Charts Types: Horizontal Bar, Vertical Bar, Line and Pie
118. What are Custom Report Types?
Custom report types allow you to build a framework in the report wizard from which users can create and customize reports.
You build custom report types off of the relationships (master-detail and lookup) between objects so that you can:
• Choose which standard and custom objects to display to users creating and customizing reports
• Define the relationships between objects displayed to users creating and customizing reports
• Select which objects’ fields can be used as columns in reports
Define custom report types to display results from an object with or without its related objects
• See which cases were closed with solutions, and which were not.
119. What is Conditional Highlighting?
Conditional highlighting is used to highlight the summary and matrix reports summary rows
We can use up to 3 conditions maximum per report to highlight.
120. What are Dashboards?
Dashboards are Visual representations of key business information and show information from multiple reports.
Dashboard can have up to 20 components
Matrix and Summary reports can be used as source reports for dashboards
Running User determines the level of access to the Dashboard Data
Dashboard refresh can be Scheduled
We can email a Dashboard
Web to Case is a method of capturing a problem/query from the customers. A web form that is published to a web site and Customers use to submit inquiries online
102. What is Email-to-Case?
Email to Case is a process of automatically creating a case when an email is sent to one of your
company’s email addresses.
103. What is an Escalation Rule?
Escalation rules are rules, automatically escalates an unresolved Case within a certain period of time (age over)
based on pre-defined business criteria
104. What are Business Hours?
Business hours are organization’s hours of operation
105. What is a Solution?
– An answer to a common question or problem
– Enables Customer Support users get up to speed quickly
– Enables Support teams to answer questions quickly and consistently
– Customers search for and browse published Solutions to selfassist
– Content-Rich Solutions are an enhancement to the Solution Object which allows solution writers to integrate rich text and
images into their solutions to completely solve a problem
What is a Category?
– Mechanism to organize Solutions
– Solutions may be associated to one or more Categories
– Categories make up a Solution Category tree structure
What are Suggested Solutions?
– The suggested solutions feature displays up to ten relevant solutions that may help users and customers solve a particular case from the case detail page and the Self-Service portal.
• Suggested Solutions can be enabled for the following:
Cases tab
Self Service Portal
Case auto-response rules and emails
106. What is the Self-Service Portal?
Self service portal is an authenticated portal which provides 24/7 online support and contains Public Knowledge Base, Suggested Solutions and Web-to-Case functionality
107. What is the AppExchange?
AppExchange is a Website Owned and Operated by salesforce.com which enables Partners and Customers to Download & Install Custom Apps and Components as per the need.
108. Jump Start Wizard vs. Standard Wizard ?
The Jump Start wizard creates a one-step approval process for you in just a few minutes
The Standard Wizard is useful for complex approval processes.
Jump Start Wizard
• The jump start wizard is useful for simple approval processes with a single step.
• Use the jump start wizard if you want to create an approval process quickly by allowing Salesforce to automatically choose some default options for you.
Standard Wizard
• The standard wizard is useful for complex approval processes.
• Use it when you want to fine tune the steps in your approval process.
• The standard wizard consists of a setup wizard that allows you to define your process and another setup wizard that allows you to define each step in the process.
109. Parallel Approval Routing ?
Parallel Approval Routing is sending approval requests to multiple approvers in a single step Wait for approval from all the approvers or wait for approval from any one
Configure an approval step to request approval from any combination of multiple users and related users
Configure 25 parallel approvers at each step
110. What is the Import Wizard?
Import Wizard is an easy-to-use multi-step wizard for importing new Accounts, Contacts, Leads, Custom Objects or Solutions. This is available only for System Administrators.
Import Wizard can be used or Account, Contact, Lead, Custom Objects or Solutions updates based on matching ID
Contact and Leads may be updated based on matching email address
Custom Objects or Solutions may be updated based on Custom Object names, Solutions titles, Salesforce ID or external ID
111. What is the input for Import Wizard?
We need to provide CSV file as a input to Import Wizard.
112. Explain Force.com Data Loader?
Force.com Data Loader is an application for the bulk import or export of data.
Data Loader is an easy-to-use wizard interface supports large files with up to millions of rows
Data Loader support for all objects, including custom objects
Use it to insert, update, delete, or extract, or upsert Salesforce records.
Force.com Data Loader can move data into or out of any salesforce.com object.
113. When to use Data Loader?
You need to load 50,000 or more records.
You need to load into an object that is not yet supported by web-based importing.
You want to schedule regular data loads, such as nightly imports.
You want to be able to save multiple mapping files for later use.
You want to export your data for backup purposes.
114. When to use web-based importing?
You are loading fewer than 50,000 records.
The object you need to import is supported by the web-based import wizards.
You want to prevent duplicates by uploading records according to account name and site, contact email address, or lead email address.
115. What is the Recycle Bin?
Recycle bin is a special folder provided by Salesforce,com, houses deleted data for approximately 30 days
Data can be recovered during this time period. Data stored in recycle bin is not counted against storage limit
If your organization reaches its Recycle Bin limit, Salesforce automatically removes the oldest records if
they have been in the Recycle Bin for at least two hours.
116. What are Trend Reports?
Trend reports are reports built on the data specified over a period.
117. What are Charts?
Charts are graphical representation of data of a single Summary or Matrix Report
Charts Types: Horizontal Bar, Vertical Bar, Line and Pie
118. What are Custom Report Types?
Custom report types allow you to build a framework in the report wizard from which users can create and customize reports.
You build custom report types off of the relationships (master-detail and lookup) between objects so that you can:
• Choose which standard and custom objects to display to users creating and customizing reports
• Define the relationships between objects displayed to users creating and customizing reports
• Select which objects’ fields can be used as columns in reports
Define custom report types to display results from an object with or without its related objects
• See which cases were closed with solutions, and which were not.
119. What is Conditional Highlighting?
Conditional highlighting is used to highlight the summary and matrix reports summary rows
We can use up to 3 conditions maximum per report to highlight.
120. What are Dashboards?
Dashboards are Visual representations of key business information and show information from multiple reports.
Dashboard can have up to 20 components
Matrix and Summary reports can be used as source reports for dashboards
Running User determines the level of access to the Dashboard Data
Dashboard refresh can be Scheduled
We can email a Dashboard
121. Explain different Dashboard Components?
Chart: Graphical representation of report results
Table: A listing of the top or bottom records from a report
Metric: A single data value – drawn from the Grand Total of a report
Gauge: A single data value – displayed as a point on a defined spectrum – drawn from the Grand Total of a report
122. What is a Campaign?
Campaign is Specific marketing program or marketing tactic, Builds awareness and generates leads
123. What is a Campaign Member?
Campaign members are Lead or contact, who is associated to the Campaign
Also, Individual who has responded to Campaign
124. Who has access to Campaigns?
• Any user in your organization can view campaigns, view the advanced campaign setup, or run campaign reports.
• However, only designated Marketing Users with the appropriate user permissions can create, edit, and delete campaigns and configure advanced campaign setup.
• An administrator must select the Marketing User checkbox on a user’s personal information to designate that user as a Marketing User.
• In addition, Marketing Users can import leads and use the campaign import wizards if they also have the Marketing User profile (or the “Import Leads” permission and “Edit” on campaigns).
• Campaigns are included with Enterprise, Unlimited, and Developer Editions, and available for an additional cost with Professional Edition.
125. What is Workflow?
Workflow is a Force.com business logic engine that allows us to automatically send emails, update fields and assign tasks based on the rule that we define
126. What all the functions can be performed using Workflows?
Salesforce Workflow gives you the ability to automatically:
• Create and send email alerts
• Create and assign tasks
• Update field values to either specific values, or based on formulas
• Create and send outbound API messages
• Create and execute time-dependent actions
127. What is a Workflow Rule?
Workflow rules are set of instructions specify the criteria for when the workflow should be activated
128. What are different workflow evaluation criteria’s and explain them?
Below are the workflow evaluation criteria’s
• When the record is created
• When the record is created and every time it’s edited
• When the record is created and any time it’s edited to subsequently meet the criteria
129. What is a Workflow Task?
Workflow Tasks assign a task to a User (Only Users) according to a particular template
130. What is a Workflow Email Alert?
Workflow Email Alerts are actions that send an Email according to a specified Email template. Workflow alerts can be sent to any User or Contact, as long as they have valid Email Address
131. What is a Workflow Field Update?
Workflow field updates are actions that update a particular field on the record that initially triggered the workflow rule
132. What are workflow actions?
Workflow actions are actions performed when a workflow rule is triggered. For example, Field updates, Alerts, Tasks and Outbound Messages
133. Can we define a single workflow rule on multiple objects?
No, Every workflow must be based on a single Object
134. What is Time-Dependent Workflow?
Time dependent workflow actions are actions that occur before or after a certain amount of time elapsed.
Time dependent workflow actions can be used to fire tasks, field updates and Email alerts.
We must specify time trigger for Time dependent workflows, this trigger define when Time dependent workflow should fire.
135. What are different workflow evaluation criteria’s and explain them?
Below are the workflow evaluation criteria’s
• When the record is created
• When the record is created and every time it’s edited
• When the record is created and any time it’s edited to subsequently meet the criteria
136. What are workflow outbound messages?
Workflow Outbound Messages is an action that sends data to an external web service
137. What are Queues?
Queues are collection of records that don’t have an Owner.
138. How can we define Queues?
Queues can be created by going to Queues in Manage Users, Enter Queue Email and by selecting Send Email to Members and select an Object under Supported Object section
139. Time-Dependent Workflow – Considerations
Maximum of 10 time triggers per rule
Maximum of 40 actions (10 x 4 types) per time trigger, and 80 actions per workflow rule
Workflow default user must be set up before creating time-based rules
Precision limited to hours or days
Cannot convert leads with time-dependent actions in the Workflow Queue
Time triggers cannot be added to or removed from activated workflow rules
Not possible to create a time-dependent action associated to a rule with a trigger type of Every time the record is created or updated
140. When the Add Time Trigger button is unavailable?
The evaluation criteria are set to Evaluate the rule when a record is: created, and every time it’s edited.
The rule is activated.
The rule is deactivated but has pending actions in the workflow queue.
Chart: Graphical representation of report results
Table: A listing of the top or bottom records from a report
Metric: A single data value – drawn from the Grand Total of a report
Gauge: A single data value – displayed as a point on a defined spectrum – drawn from the Grand Total of a report
122. What is a Campaign?
Campaign is Specific marketing program or marketing tactic, Builds awareness and generates leads
123. What is a Campaign Member?
Campaign members are Lead or contact, who is associated to the Campaign
Also, Individual who has responded to Campaign
124. Who has access to Campaigns?
• Any user in your organization can view campaigns, view the advanced campaign setup, or run campaign reports.
• However, only designated Marketing Users with the appropriate user permissions can create, edit, and delete campaigns and configure advanced campaign setup.
• An administrator must select the Marketing User checkbox on a user’s personal information to designate that user as a Marketing User.
• In addition, Marketing Users can import leads and use the campaign import wizards if they also have the Marketing User profile (or the “Import Leads” permission and “Edit” on campaigns).
• Campaigns are included with Enterprise, Unlimited, and Developer Editions, and available for an additional cost with Professional Edition.
125. What is Workflow?
Workflow is a Force.com business logic engine that allows us to automatically send emails, update fields and assign tasks based on the rule that we define
126. What all the functions can be performed using Workflows?
Salesforce Workflow gives you the ability to automatically:
• Create and send email alerts
• Create and assign tasks
• Update field values to either specific values, or based on formulas
• Create and send outbound API messages
• Create and execute time-dependent actions
127. What is a Workflow Rule?
Workflow rules are set of instructions specify the criteria for when the workflow should be activated
128. What are different workflow evaluation criteria’s and explain them?
Below are the workflow evaluation criteria’s
• When the record is created
• When the record is created and every time it’s edited
• When the record is created and any time it’s edited to subsequently meet the criteria
129. What is a Workflow Task?
Workflow Tasks assign a task to a User (Only Users) according to a particular template
130. What is a Workflow Email Alert?
Workflow Email Alerts are actions that send an Email according to a specified Email template. Workflow alerts can be sent to any User or Contact, as long as they have valid Email Address
131. What is a Workflow Field Update?
Workflow field updates are actions that update a particular field on the record that initially triggered the workflow rule
132. What are workflow actions?
Workflow actions are actions performed when a workflow rule is triggered. For example, Field updates, Alerts, Tasks and Outbound Messages
133. Can we define a single workflow rule on multiple objects?
No, Every workflow must be based on a single Object
134. What is Time-Dependent Workflow?
Time dependent workflow actions are actions that occur before or after a certain amount of time elapsed.
Time dependent workflow actions can be used to fire tasks, field updates and Email alerts.
We must specify time trigger for Time dependent workflows, this trigger define when Time dependent workflow should fire.
135. What are different workflow evaluation criteria’s and explain them?
Below are the workflow evaluation criteria’s
• When the record is created
• When the record is created and every time it’s edited
• When the record is created and any time it’s edited to subsequently meet the criteria
136. What are workflow outbound messages?
Workflow Outbound Messages is an action that sends data to an external web service
137. What are Queues?
Queues are collection of records that don’t have an Owner.
138. How can we define Queues?
Queues can be created by going to Queues in Manage Users, Enter Queue Email and by selecting Send Email to Members and select an Object under Supported Object section
139. Time-Dependent Workflow – Considerations
Maximum of 10 time triggers per rule
Maximum of 40 actions (10 x 4 types) per time trigger, and 80 actions per workflow rule
Workflow default user must be set up before creating time-based rules
Precision limited to hours or days
Cannot convert leads with time-dependent actions in the Workflow Queue
Time triggers cannot be added to or removed from activated workflow rules
Not possible to create a time-dependent action associated to a rule with a trigger type of Every time the record is created or updated
140. When the Add Time Trigger button is unavailable?
The evaluation criteria are set to Evaluate the rule when a record is: created, and every time it’s edited.
The rule is activated.
The rule is deactivated but has pending actions in the workflow queue.
141. Time-Dependent Workflow Limitations:
Time triggers don’t support minutes or seconds.
Time triggers can’t reference the following:
• DATE or DATETIME fields containing automatically derived functions, such as TODAY or NOW.
• Formula fields that include related-object merge fields.
You can’t add or remove time triggers if:
• The workflow rule is active.
• The workflow rule is deactivated but has pending actions in the queue.
• The workflow rule evaluation criteria are set to Evaluate the rule when a record is: created, and every time it’s edited.
• The workflow rule is included in a package
.
142. What is Approval Processing?
Approval process is a force.com business logic engine that allows you to specify a sequence of steps that are required to approve a new record. Each step allows one or more designated approvers to accept or reject the record.
143. Approval Terminology
• Approval Request: An approval request is an email notifying the recipient that a record was submitted for approval and his or her approval is requested.
• Approval Steps: Approval steps assign approval requests to various users and define the chain of approval for a particular approval process.
– Each approval step specifies the attributes a record must have to advance to that approval step, the user who can approve requests for those records, and whether to allow the delegate of the approver to approve the requests.
– The first approval step in a process also specifies the action to take if a record does not advance to that step.
– Subsequent steps in the process also allow you to specify what happens if an approver rejects the request.
• Assigned Approver: The assigned approver is the user responsible for approving an approval request.
• Initial Submission Actions: are the actions that occur when a user first submits a record for approval.
– For example, an initial submission action can lock the record so that no users can edit it during the approval process.
– Initial submission actions can also include any approval actions such as assigning a task, sending an email, or updating a field.
• Final Approval Actions: are the actions that occur when all approval requests for a record are approved.
– Final approval actions can include any approval actions such as email alerts, field updates, tasks, or outbound messages.
– For example, a final approval action can change the status to “Approved” and send a notification email.
• Final Rejection Actions: are the actions that occur when all approval requests for a record are rejected.
– Final rejection actions can include any approval actions such as email alerts, field updates, tasks, or outbound messages.
– For example, a final rejection action can change the status to “Rejected”, send a notification email, and unlock the record so that users can edit it before resubmitting.
• Record Locking: is the process of preventing users from editing a record regardless of field-level security or sharing settings.
– Records that are pending approval are automatically locked by Salesforce.
– Users must have the “Modify All Data” permission to edit locked records.
– The Initial Submission Actions, Final Approval Actions, and Final Rejection Actions related lists contain a record lock action that you can edit if necessary
• Outbound Messages: send the information you specify to an endpoint you designate.
– You can set up workflow rules and approval processes to send outbound messages to an endpoint as a means of getting information to an external service.
144. Approval Process Checklist
Use the following checklist to plan your approval process:
– Prepare an Approval Request Email
– Determine the Approval Request Sender
– Determine the Assigned Approver
– Determine the Delegated Approver
– Decide if your approval process needs a filter
– Decide initial submission actions
– Decide if users can approve requests from a wireless device
– Determine if users can edit records that are awaiting approval
– Decide if records should be auto-approved or rejected
– Determine how many levels your process has
– Determine the actions when an approval request is approved or rejected.
145. What is Standard and Custom Fields in Salesforce?
Standard Fields
Standard Fields are pre-defined in Salesforce and you cannot delete standard fields but you can remove non-required standard fields from a page layout
Standard Field customizations include the ability to change standard field labels and tabs
• You can change the display labels of standard tabs, objects, fields, and other related user interface labels so they better reflect your organization’s business requirements.
• Renamed labels – for example, “Accounts” changed to “Companies” – display on all user pages, in Outlook Edition, and in Offline Edition.
• It’s important to note that all pages in the Setup area use the default, original labels.
• Reports and views are not renamed based on the new label value
Custom Fields
Capture information unique to your business process by creating custom fields with custom field help for each of the tabs that your organization uses
Recycle Bin for Deleted Custom Fields
Custom fields are deleted permanently after 45 days
146. Is it possible to change the existing data types of custom fields, if Yes please explain?
Yes. It’s possible but changing the data type of an existing custom field can cause data loss in the following situations:
• Changing to or from type Date or Date/Time
• Changing to Number from any other type
• Changing to Percent from any other type
• Changing to Currency from any other type
• Changing from Checkbox to any other type
• Changing from Picklist (Multi-Select) to any other type
• Changing to Picklist (Multi-Select) from any type except Picklist
• Changing from Auto Number to any other type
• Changing to Auto Number from any type except Text
• Changing from Text Area (Long) to any type except Email, Phone, Text, Text Area, or URL
147. What is a dependent picklist?
Dependent fields can help make your data more accurate and consistent by applying filters.
A dependent field works in conjunction with a controlling field to filter its values. The value chosen in the controlling field affects the values available in the dependent field.
300 is the maximum number of values allowed in a controlling picklist
A custom multi-select picklist cannot be the controlling field for a dependent field
Field Type Controlling Field Dependent Field
Standard Picklist Yes No
Custom Picklist Yes Yes
Custom Multi-Select No Yes
Standard Checkbox Yes No
Custom Checkbox Yes No
148. What is a Business Process?
Business process allows you to track separate sales, support, and lead lifecycles across different divisions, groups, or markets.
Available Business Processes:
Sales Processes – Create different sales processes that include some or all of the picklist values available for the Opportunity Stage field
Support Processes – Create different support processes that include some or all of the picklist values available for the Case Status field
Lead Processes – Create different lead processes that include some or all of the picklist values available for the Lead Status field
Solution Processes – Create different solution processes that include some or all of the picklist values available for the Solution Status field
149. What is Web-to-Lead and Web-to-Case? (More explanation needed)
A lead or case record created through Web-to-Lead or Web-to-Case will set the record type to that of the default lead owner or automated case user (optional)
150. On which tabs can I create multiple record types?
Multiple record types may be created for every tab, with the exception of the Home, Forecasts, Documents, and Reports tabs.
151. What happens if I try to add new picklist value?
You will be prompted to select which record types should include the new value
152. Why use Field-Level Security?
Use Field-Level Security (rather than creating multiple page layouts) to enforce data security
Users view data relevant to their job function Troubleshooting Tools Field accessibility views
Setup | Administration Setup | Security Controls | Field Accessibility
Notes:
• Field Level Security is not available in PE
• Field-level security cannot be used to make a field required. This is done from the Page Layout
• Field access settings can be defined using both field-level security and page layouts. However, the most restrictive field access setting of the two will always apply.
For example, if a field is required on the page layout, but read-only in the field-level security settings, the field will be read-only.
• Hiding a field from a user using FLS also hides that field from list views, search results, and reports.
153. What are Login Hours and Login IP Ranges?
Login hour sets the hours when users with a particular profile can use the system
Login IP Ranges sets the IP addresses from which users with a particular profile can log in
Notes:
• You can customize profiles to restrict users’ ability to log in to Salesforce.
• You can set the hours when users can log in and the IP addresses from which they can log in.
If a user logs in before the restricted hours, the system will end the user’s session when the restricted hours begin.
Two Options for Restricting Access via IP Ranges
Option 1: Add Trusted IP Ranges for your entire org
Option 2: Add Trusted IP Ranges on a Profile by Profile basis
154. What is a User Record?
User record possesses key information about a user and each has its own unique username.
Other properties of User records are below
• User logs in with username and password
• Users can be active or inactive; an active user uses a license
• Users are associated with a Profile
• Users are usually associated with a Role
155. What is a Record Owner?
Record owner is he user (or queue for Cases and Leads) who controls or has rights to that particular data record.
An Owner has the following special privileges with the below assumptions:
• View and edit capabilities
• Transfer capability – change ownership
• Deletion capabilities
Important assumption:
Object permissions enabled
The Account Owner, Opportunity Owners and Case Owners may or may not be the same user.
156. What are Organization Wide Defaults?
OWD Defines the baseline level of access to data records for all users in the Organization (not including records owned by the user or inherited via role hierarchy) Used to restrict access to data Access levels to
Private
Public Read/Write
Public Read/Write/Transfer
Public Full Access
Public Read Only
157. What is a Role and Role Hierarchy?
Role:
Controls the level of visibility that users have to an organization’s data
An user may be associated to one role
Role Hierarchy:
Controls data visibility
Controls record roll up – forecasting and reporting
Users inherit the special privileges of data owned by or shared with users below them in the hierarchy
Not necessarily the company’s organization chart
Notes:
• If using Customizable Forecasting, there is a separate forecast role hierarchy.
• EE can create Account, Contact, Opportunity and Case Sharing Rules. PE can ONLY create Account and Contact Sharing Rules.
• Assuming no sharing rules have been created, users in the same role cannot access one another’s records.
Example: Org Wide Default settings for opportunities are private. Creating a role and adding two users to that role does not allow those users access to one another’s opportunities.
• “Grant Access Using Hierarchies” allows you to disable the default sharing access granted by your role and territory hierarchies. This option can be changed for custom objects that do not have their organization-wide default sharing setting set to Controlled by Parent.
158. What is Access at the Role Level?
Access is defined when creating a role
Level of access to Opportunities associated to Accounts owned by the role
Level of access to Contacts associated to Accounts owned by the Role
Level of access to Cases associated to Accounts owned by the role
Level of access options depend on OWD
Notes:
• You can create up to 500 roles for your organization
• Every user must be assigned to a role, or their data will not display in opportunity reports, forecast roll-ups, and other displays based on roles
• All users that require visibility to the entire organization should belong to the highest level in the hierarchy
• It is not necessary to create individual roles for each title at your company, rather you want to define a hierarchy of roles to control access of information entered by users in lower level roles
• When you change a user’s role, any relevant sharing rules are evaluated to add or remove access as necessary
159. What is a Sharing Rule?
Sharing rules are automated rules that grant access to groups of users
These are exceptions to Organization Wide Defaults
Irrelevant for Public Read/Write organizations
Levels of Access that can be granted are
• Read Only
• Read/Write
Notes:
• Sharing rules should be used when a user or group of users needs access to records not granted them by either the role hierarchy setup or the organization wide default settings.
• Sharing rules open up access whereas organization wide defaults restrict access.
• You can use sharing rules to grant wider access to data. You cannot restrict access below your organization-wide default levels.
• Sharing rules apply to all new and existing records owned by the specified role or group members.
• Sharing rules apply to both active and inactive users.
• When you change the access levels for a sharing rule, all existing records are automatically updated to reflect the new access levels.
• When you delete a sharing rule, the sharing access created by that rule is automatically removed.
• When you transfer records from one user to another, the sharing rules are reevaluated to add or remove access to the transferred records as necessary.
• When you modify which users are in a group or role, the sharing rules are reevaluated to add or remove access as necessary.
• For contact, opportunity and case sharing rules, if the role or group members do not have access to the account associated with the shared contact, opportunity or case the rule automatically gives them access to view the account as well.
• Managers in the role hierarchy are automatically granted the same access that users below them in the hierarchy have from a sharing rule.
• You can edit the access levels for any sharing rule. You cannot change the specified groups or roles for the rule.
160. What are the types of Sharing Rules in Salesforce and explain them?
Sharing rules present in salesforce are as below.
Account Sharing Rules:
• Based on who owns the account
• Set default sharing access for accounts and their associated cases, contacts, contracts, and opportunities
Contact Sharing Rules:
• Based on who owns the contact (must be associated with an account)
• Set default sharing access for individual contacts and their associated accounts
• Cannot use with: Territory Management and B2I (Person Account) enabled orgs
Opportunity Sharing Rules (EE/UE):
• Based on who owns the opportunity
• Set default sharing access for individual opportunities and their associated accounts
Case Sharing Rules (EE/UE):
• Based on who owns the case
• Set default sharing access for individual cases and associated accounts
Lead Sharing Rules (EE/UE):
• Based on who owns the lead
• Set default sharing access for individual leads
Custom Object Sharing Rules (EE/UE):
• Based on who owns the custom object
• Set default sharing access for individual custom object records
Time triggers don’t support minutes or seconds.
Time triggers can’t reference the following:
• DATE or DATETIME fields containing automatically derived functions, such as TODAY or NOW.
• Formula fields that include related-object merge fields.
You can’t add or remove time triggers if:
• The workflow rule is active.
• The workflow rule is deactivated but has pending actions in the queue.
• The workflow rule evaluation criteria are set to Evaluate the rule when a record is: created, and every time it’s edited.
• The workflow rule is included in a package
.
142. What is Approval Processing?
Approval process is a force.com business logic engine that allows you to specify a sequence of steps that are required to approve a new record. Each step allows one or more designated approvers to accept or reject the record.
143. Approval Terminology
• Approval Request: An approval request is an email notifying the recipient that a record was submitted for approval and his or her approval is requested.
• Approval Steps: Approval steps assign approval requests to various users and define the chain of approval for a particular approval process.
– Each approval step specifies the attributes a record must have to advance to that approval step, the user who can approve requests for those records, and whether to allow the delegate of the approver to approve the requests.
– The first approval step in a process also specifies the action to take if a record does not advance to that step.
– Subsequent steps in the process also allow you to specify what happens if an approver rejects the request.
• Assigned Approver: The assigned approver is the user responsible for approving an approval request.
• Initial Submission Actions: are the actions that occur when a user first submits a record for approval.
– For example, an initial submission action can lock the record so that no users can edit it during the approval process.
– Initial submission actions can also include any approval actions such as assigning a task, sending an email, or updating a field.
• Final Approval Actions: are the actions that occur when all approval requests for a record are approved.
– Final approval actions can include any approval actions such as email alerts, field updates, tasks, or outbound messages.
– For example, a final approval action can change the status to “Approved” and send a notification email.
• Final Rejection Actions: are the actions that occur when all approval requests for a record are rejected.
– Final rejection actions can include any approval actions such as email alerts, field updates, tasks, or outbound messages.
– For example, a final rejection action can change the status to “Rejected”, send a notification email, and unlock the record so that users can edit it before resubmitting.
• Record Locking: is the process of preventing users from editing a record regardless of field-level security or sharing settings.
– Records that are pending approval are automatically locked by Salesforce.
– Users must have the “Modify All Data” permission to edit locked records.
– The Initial Submission Actions, Final Approval Actions, and Final Rejection Actions related lists contain a record lock action that you can edit if necessary
• Outbound Messages: send the information you specify to an endpoint you designate.
– You can set up workflow rules and approval processes to send outbound messages to an endpoint as a means of getting information to an external service.
144. Approval Process Checklist
Use the following checklist to plan your approval process:
– Prepare an Approval Request Email
– Determine the Approval Request Sender
– Determine the Assigned Approver
– Determine the Delegated Approver
– Decide if your approval process needs a filter
– Decide initial submission actions
– Decide if users can approve requests from a wireless device
– Determine if users can edit records that are awaiting approval
– Decide if records should be auto-approved or rejected
– Determine how many levels your process has
– Determine the actions when an approval request is approved or rejected.
145. What is Standard and Custom Fields in Salesforce?
Standard Fields
Standard Fields are pre-defined in Salesforce and you cannot delete standard fields but you can remove non-required standard fields from a page layout
Standard Field customizations include the ability to change standard field labels and tabs
• You can change the display labels of standard tabs, objects, fields, and other related user interface labels so they better reflect your organization’s business requirements.
• Renamed labels – for example, “Accounts” changed to “Companies” – display on all user pages, in Outlook Edition, and in Offline Edition.
• It’s important to note that all pages in the Setup area use the default, original labels.
• Reports and views are not renamed based on the new label value
Custom Fields
Capture information unique to your business process by creating custom fields with custom field help for each of the tabs that your organization uses
Recycle Bin for Deleted Custom Fields
Custom fields are deleted permanently after 45 days
146. Is it possible to change the existing data types of custom fields, if Yes please explain?
Yes. It’s possible but changing the data type of an existing custom field can cause data loss in the following situations:
• Changing to or from type Date or Date/Time
• Changing to Number from any other type
• Changing to Percent from any other type
• Changing to Currency from any other type
• Changing from Checkbox to any other type
• Changing from Picklist (Multi-Select) to any other type
• Changing to Picklist (Multi-Select) from any type except Picklist
• Changing from Auto Number to any other type
• Changing to Auto Number from any type except Text
• Changing from Text Area (Long) to any type except Email, Phone, Text, Text Area, or URL
147. What is a dependent picklist?
Dependent fields can help make your data more accurate and consistent by applying filters.
A dependent field works in conjunction with a controlling field to filter its values. The value chosen in the controlling field affects the values available in the dependent field.
300 is the maximum number of values allowed in a controlling picklist
A custom multi-select picklist cannot be the controlling field for a dependent field
Field Type Controlling Field Dependent Field
Standard Picklist Yes No
Custom Picklist Yes Yes
Custom Multi-Select No Yes
Standard Checkbox Yes No
Custom Checkbox Yes No
148. What is a Business Process?
Business process allows you to track separate sales, support, and lead lifecycles across different divisions, groups, or markets.
Available Business Processes:
Sales Processes – Create different sales processes that include some or all of the picklist values available for the Opportunity Stage field
Support Processes – Create different support processes that include some or all of the picklist values available for the Case Status field
Lead Processes – Create different lead processes that include some or all of the picklist values available for the Lead Status field
Solution Processes – Create different solution processes that include some or all of the picklist values available for the Solution Status field
149. What is Web-to-Lead and Web-to-Case? (More explanation needed)
A lead or case record created through Web-to-Lead or Web-to-Case will set the record type to that of the default lead owner or automated case user (optional)
150. On which tabs can I create multiple record types?
Multiple record types may be created for every tab, with the exception of the Home, Forecasts, Documents, and Reports tabs.
151. What happens if I try to add new picklist value?
You will be prompted to select which record types should include the new value
152. Why use Field-Level Security?
Use Field-Level Security (rather than creating multiple page layouts) to enforce data security
Users view data relevant to their job function Troubleshooting Tools Field accessibility views
Setup | Administration Setup | Security Controls | Field Accessibility
Notes:
• Field Level Security is not available in PE
• Field-level security cannot be used to make a field required. This is done from the Page Layout
• Field access settings can be defined using both field-level security and page layouts. However, the most restrictive field access setting of the two will always apply.
For example, if a field is required on the page layout, but read-only in the field-level security settings, the field will be read-only.
• Hiding a field from a user using FLS also hides that field from list views, search results, and reports.
153. What are Login Hours and Login IP Ranges?
Login hour sets the hours when users with a particular profile can use the system
Login IP Ranges sets the IP addresses from which users with a particular profile can log in
Notes:
• You can customize profiles to restrict users’ ability to log in to Salesforce.
• You can set the hours when users can log in and the IP addresses from which they can log in.
If a user logs in before the restricted hours, the system will end the user’s session when the restricted hours begin.
Two Options for Restricting Access via IP Ranges
Option 1: Add Trusted IP Ranges for your entire org
Option 2: Add Trusted IP Ranges on a Profile by Profile basis
154. What is a User Record?
User record possesses key information about a user and each has its own unique username.
Other properties of User records are below
• User logs in with username and password
• Users can be active or inactive; an active user uses a license
• Users are associated with a Profile
• Users are usually associated with a Role
155. What is a Record Owner?
Record owner is he user (or queue for Cases and Leads) who controls or has rights to that particular data record.
An Owner has the following special privileges with the below assumptions:
• View and edit capabilities
• Transfer capability – change ownership
• Deletion capabilities
Important assumption:
Object permissions enabled
The Account Owner, Opportunity Owners and Case Owners may or may not be the same user.
156. What are Organization Wide Defaults?
OWD Defines the baseline level of access to data records for all users in the Organization (not including records owned by the user or inherited via role hierarchy) Used to restrict access to data Access levels to
Private
Public Read/Write
Public Read/Write/Transfer
Public Full Access
Public Read Only
157. What is a Role and Role Hierarchy?
Role:
Controls the level of visibility that users have to an organization’s data
An user may be associated to one role
Role Hierarchy:
Controls data visibility
Controls record roll up – forecasting and reporting
Users inherit the special privileges of data owned by or shared with users below them in the hierarchy
Not necessarily the company’s organization chart
Notes:
• If using Customizable Forecasting, there is a separate forecast role hierarchy.
• EE can create Account, Contact, Opportunity and Case Sharing Rules. PE can ONLY create Account and Contact Sharing Rules.
• Assuming no sharing rules have been created, users in the same role cannot access one another’s records.
Example: Org Wide Default settings for opportunities are private. Creating a role and adding two users to that role does not allow those users access to one another’s opportunities.
• “Grant Access Using Hierarchies” allows you to disable the default sharing access granted by your role and territory hierarchies. This option can be changed for custom objects that do not have their organization-wide default sharing setting set to Controlled by Parent.
158. What is Access at the Role Level?
Access is defined when creating a role
Level of access to Opportunities associated to Accounts owned by the role
Level of access to Contacts associated to Accounts owned by the Role
Level of access to Cases associated to Accounts owned by the role
Level of access options depend on OWD
Notes:
• You can create up to 500 roles for your organization
• Every user must be assigned to a role, or their data will not display in opportunity reports, forecast roll-ups, and other displays based on roles
• All users that require visibility to the entire organization should belong to the highest level in the hierarchy
• It is not necessary to create individual roles for each title at your company, rather you want to define a hierarchy of roles to control access of information entered by users in lower level roles
• When you change a user’s role, any relevant sharing rules are evaluated to add or remove access as necessary
159. What is a Sharing Rule?
Sharing rules are automated rules that grant access to groups of users
These are exceptions to Organization Wide Defaults
Irrelevant for Public Read/Write organizations
Levels of Access that can be granted are
• Read Only
• Read/Write
Notes:
• Sharing rules should be used when a user or group of users needs access to records not granted them by either the role hierarchy setup or the organization wide default settings.
• Sharing rules open up access whereas organization wide defaults restrict access.
• You can use sharing rules to grant wider access to data. You cannot restrict access below your organization-wide default levels.
• Sharing rules apply to all new and existing records owned by the specified role or group members.
• Sharing rules apply to both active and inactive users.
• When you change the access levels for a sharing rule, all existing records are automatically updated to reflect the new access levels.
• When you delete a sharing rule, the sharing access created by that rule is automatically removed.
• When you transfer records from one user to another, the sharing rules are reevaluated to add or remove access to the transferred records as necessary.
• When you modify which users are in a group or role, the sharing rules are reevaluated to add or remove access as necessary.
• For contact, opportunity and case sharing rules, if the role or group members do not have access to the account associated with the shared contact, opportunity or case the rule automatically gives them access to view the account as well.
• Managers in the role hierarchy are automatically granted the same access that users below them in the hierarchy have from a sharing rule.
• You can edit the access levels for any sharing rule. You cannot change the specified groups or roles for the rule.
160. What are the types of Sharing Rules in Salesforce and explain them?
Sharing rules present in salesforce are as below.
Account Sharing Rules:
• Based on who owns the account
• Set default sharing access for accounts and their associated cases, contacts, contracts, and opportunities
Contact Sharing Rules:
• Based on who owns the contact (must be associated with an account)
• Set default sharing access for individual contacts and their associated accounts
• Cannot use with: Territory Management and B2I (Person Account) enabled orgs
Opportunity Sharing Rules (EE/UE):
• Based on who owns the opportunity
• Set default sharing access for individual opportunities and their associated accounts
Case Sharing Rules (EE/UE):
• Based on who owns the case
• Set default sharing access for individual cases and associated accounts
Lead Sharing Rules (EE/UE):
• Based on who owns the lead
• Set default sharing access for individual leads
Custom Object Sharing Rules (EE/UE):
• Based on who owns the custom object
• Set default sharing access for individual custom object records
161. Best Practices of Creating Contact Sharing Rules?
• Account Org-Wide Default must be set to at least “Public Read Only” in order to set the Contact Org-Wide Default to “Public Read/Write”.
• To share ALL contacts in the system with a group of users or a specific role, create a sharing rule that uses the “All Internal Users” (or “Entire Organization”) public group as the owned by option.
• Use “Roles and Subordinates” over “Roles” where possible to minimize the number of sharing rules.
162. What is a Public Group?
Public group is a grouping of:
• Users
• Public Groups (nesting)
• Roles
• Roles and Subordinates
• Mixture of any of these elements
Used in Sharing Rules – for simplification (when more than a few roles need to be shared to)
Also used when defining access to Folders and List Views
For example, if a new user is assigned a role that belongs to an existing public group, that user will be
automatically added to the public group
163. What is Manual Sharing?
Manual sharing is granting record access, one-off basis
Owner, anyone above owner in role hierarchy and administrator can manually share records
Available on Contacts, Leads, Cases, Accounts and Opportunity records and Custom Objects
Like sharing rules, irrelevant for Public Read/Write organizations
164. What are Folders in salesforce?
Folders are used for organizing email templates, documents, reports and dashboards
Access is defined – Read or Read/Write
Access is explicit – does NOT roll up through role hierarchy
Notes:
You can modify the contents of a folder if the folder access level is set to Read/Write.
Only users with the “Manage Public Documents” or “Manage Public Templates” can delete or change a Read Only folder.
The Documents tab does NOT contain version control capabilities
To search documents, users must use Documents search. The sidebar search does NOT search Documents, Solutions, Products, and Reports but does search Assets and Custom Objects
The Create New Folder link will only be visible to users with the “Manage Public Documents” permission
The size limit for documents uploaded is 5MB. The size limit for document filenames is 255 characters including the file extension
165. What are the difference between Sandbox and Developer Editions?
Sandbox Developer Edition
The salesforce.com Sandbox environment is an exact copy of your salesforce.com instance. Developer Edition was an edition created for development of integrations and apps, specifically for the AppExchange.
You can copy your live instance to a sandbox environment. You have to perform manually from sandbox to developer edition.
You can either copy your configuration and data into a sandbox environment or just the configuration. You cannot copy your configuration or data onto the Developer Edition, but you can customize it to match your instance’s look and feel.
166. How to restrict the user to see any record let’s say CASES?
Set up cases sharing to be private. If both users are admins or have view all records on cases, then that overrides private sharing.
167. What is External ID?
External ID is a field or flag on any custom field of type Text, Number or Email
External ID is Case INSENSITIVE
External ID are restricted to Three ID fields per object
External ID can be Custom fields only.
168. What are Relative Dates?
Related dates are dates used in Views and Reports for filtering.
These are dynamic date range, based on current date
Examples: This Week, Next Month, Last 90 Days
Available Relative Date Filters (not case sensitive)
• Today
• Yesterday
• Tomorrow
• This Week
• Last Week
• Next Week
• This Month
• Last Month
• Next Month
• Last x Days
• Next x Days
• Quarter
• Year
• Fiscal Quarter
• Fiscal Year
169. How is Role Different from the Profile?
Roles and Profiles are two different concepts in Salesforce.com, Some of the basic differences are:
• Profile helps to put restrictions on the Object where as the Role helps in opening the records to the users above the Role hierarchy
• Profile manages the Salesforce.com License, Tabs Settings, Record types, Page layouts, General Settings, Administrator Settings etc; Role hierarchy does not do any of these things
• Profile is Mandatory, Role is not
170. What are the different ways of making a field mandatory?
In salesforce we can make fields mandatory by 3 ways
1. Page Layout: - Field can be made mandatory from the page layout when it needs to be made mandatory for a set of users
2. Field Level Security: - Field can be made mandatory from the FLS when it needs to be made mandatory for all the users in the Organization and even from the API’s
3. Validation Rule: - Field can be made mandatory from the Validation Rule when it needs to be made mandatory for user who is using the same Page layout used by other users
Salesforce.com recommends using the Page Layout option for making the field mandatory.
171. What are the Different Ways in which leads can be created in salesforce.com?
Some of the ways in which leads can be generated and created in salesforce.com are
• Walk In to a company: User comes to the company office and then Salesforce.com rep manually creates the Lead
• Data Base bought by the company and then leads loaded via Data Loader/Import Wizard in salesforce.com
• Leads created because of the Campaigns, Seminars, and Tradeshows
• Web to Lead: Users registering on the website of the company.
• Email to Lead & SMS to Lead can be custom build for the Organization
172. Can a Contact be part of Partner Portal as well as Customer Portal in salesforce.com?
Yes, a contact can be part of a Partner Portal as well as Customer portal in salesforce.com.
Customer Portal and Partner portal depend on the user object and are not related to the contact object.
So to enable both portals for a Contact we need to create two users which will utilize two different salesforce.com licenses, one license for Customer portal and other for Partner portal.
Both users created for a same contact will have two different profiles, One for Customer portal and other for Partner Portal.
173. When are the Record types used?
Record Types are used in the following two cases
• To assign the different Page layouts to different users based on their profiles
• To enable different sets of Standard/Custom Picklist values for two different users using the same page layout
174. What are Profile Components?
Profiles Components:
• Which standard and custom apps users can view
• Which tabs users can view
• Which record types are available to users
• Which page layouts users see
• Object permissions that allow users to create, read, edit, and delete records
• Which fields within objects users can view and edit
• Permissions that allow users to manage the system and apps within it
• Which Apex classes and Visualforce pages users can access
• Which desktop clients users can access
• The hours during which and IP addresses from which users can log in
• Which service providers users can access (if Salesforce is enabled as an identity provider)
175. Explain Profile Vs Permission Sets Permissions and Access Settings?
The following table shows the types of permissions and access settings that are specified in profiles and permission sets. Some profile settings aren’t included in permission sets.
Permission or Setting Type In Profiles? In Permission Sets?
Assigned apps TRUE TRUE
Tab settings TRUE TRUE
Record type assignments TRUE
Page layout assignments TRUE
Object permissions TRUE TRUE
Field permissions TRUE TRUE
User permissions (app and system) TRUE TRUE
Apex class access TRUE TRUE
Visualforce page access TRUE TRUE
Service provider access (if Salesforce is enabled as an identity provider) TRUE TRUE
Desktop client access TRUE
Login hours TRUE
Login IP ranges TRUE
176. What are the Standard Profiles available in Salesforce?
There are Six (6) Standard Profiles available in salesforce (EE/UE and PE)
• Standard User – Can view, edit, and delete their own records
• Solution Manager – Standard User permissions + Can manage published solutions + Can manage categories
• Marketing User – Standard User permissions + Can import leads for the organization
• Contract Manager – Standard User permissions + Can edit, approve, activate, and delete contracts
• Read-Only – Can only view records
• System Administrator – “Super User,” can customize and administer the application
177. What are Standard Business Objects?
Standard Business objects are mentioned below.
Object Description
Campaigns A Campaign is any marketing project that you want to plan, manage, and track in Salesforce.
Leads A Lead is any person, organization or company that may be interested in your products. Sometimes Leads are referred to as Prospects or Suspects. Leads are not yet customers.
Accounts An Account is an organization, individual or company involved with your business such as customers, competitors and partners that you wish to track in Salesforce
Contacts A Contact is any individual or influencer associated with an account that you want to track in Salesforce
Opportunities An Opportunity is any potential revenue-generating event (“sales deal” ) that you want to
track in Salesforce
Cases A case is a detailed description of a customer’s feedback, problem or question
Solutions A solution is a detailed description of a customer issue and the resolution of that issue. The
collection of your organization’s solutions is sometimes referred to as the solution knowledge base
Forecasts A forecast is your best estimate of how much revenue you can generate in a quarter
Documents
Reports Reports are summaries and analyses of your data, which you can display or print
Dashboards Dashboards give you a real-time snapshot of corporate metrics and key performance
indicators. A dashboard is a group of different charts (or components) that graphically display your custom
report data
Calendar and Task Activities are both tasks and scheduled calendar events. You can define and track activities for many different objects, including campaigns, accounts, contacts, and leads
Products Products are the individual items that you sell on your opportunities. (Please note that Products are available in EE/UE and Developer and in PE for an additional fee.)
178. What is a Company Profile?
Company profile contains core information for your company.
Below are the key information includes in company profile
• Language, Locale and Time Zone
• Licenses
• Storage and Used Space
• Fiscal Year
• Primary Contact and Address information
• Manage Currencies
179. What is a Fiscal Year in Salesforce?
Financial year in salesforce is used for an organizations financial planning.
This is usually a year in length and impacts forecasts, quotas and reports
Salesforce allows two types:
• Standard Fiscal Years are periods that follow the Gregorian calendar, but can start on the first day of any month of the year. (A Gregorian Year is a calendar based on a 12 Month Structure and is used throughout
much of the world.)
• Custom Fiscal Years are for companies that break down their fiscal years, quarters and weeks in to custom fiscal periods based on their financial planning requirements.
180. Can we use Custom financial year in forecasting?
We can NOT use Custom financial year in forecasting. But Customizable Forecasting must be enabled for use with Custom Fiscal Years
• Account Org-Wide Default must be set to at least “Public Read Only” in order to set the Contact Org-Wide Default to “Public Read/Write”.
• To share ALL contacts in the system with a group of users or a specific role, create a sharing rule that uses the “All Internal Users” (or “Entire Organization”) public group as the owned by option.
• Use “Roles and Subordinates” over “Roles” where possible to minimize the number of sharing rules.
162. What is a Public Group?
Public group is a grouping of:
• Users
• Public Groups (nesting)
• Roles
• Roles and Subordinates
• Mixture of any of these elements
Used in Sharing Rules – for simplification (when more than a few roles need to be shared to)
Also used when defining access to Folders and List Views
For example, if a new user is assigned a role that belongs to an existing public group, that user will be
automatically added to the public group
163. What is Manual Sharing?
Manual sharing is granting record access, one-off basis
Owner, anyone above owner in role hierarchy and administrator can manually share records
Available on Contacts, Leads, Cases, Accounts and Opportunity records and Custom Objects
Like sharing rules, irrelevant for Public Read/Write organizations
164. What are Folders in salesforce?
Folders are used for organizing email templates, documents, reports and dashboards
Access is defined – Read or Read/Write
Access is explicit – does NOT roll up through role hierarchy
Notes:
You can modify the contents of a folder if the folder access level is set to Read/Write.
Only users with the “Manage Public Documents” or “Manage Public Templates” can delete or change a Read Only folder.
The Documents tab does NOT contain version control capabilities
To search documents, users must use Documents search. The sidebar search does NOT search Documents, Solutions, Products, and Reports but does search Assets and Custom Objects
The Create New Folder link will only be visible to users with the “Manage Public Documents” permission
The size limit for documents uploaded is 5MB. The size limit for document filenames is 255 characters including the file extension
165. What are the difference between Sandbox and Developer Editions?
Sandbox Developer Edition
The salesforce.com Sandbox environment is an exact copy of your salesforce.com instance. Developer Edition was an edition created for development of integrations and apps, specifically for the AppExchange.
You can copy your live instance to a sandbox environment. You have to perform manually from sandbox to developer edition.
You can either copy your configuration and data into a sandbox environment or just the configuration. You cannot copy your configuration or data onto the Developer Edition, but you can customize it to match your instance’s look and feel.
166. How to restrict the user to see any record let’s say CASES?
Set up cases sharing to be private. If both users are admins or have view all records on cases, then that overrides private sharing.
167. What is External ID?
External ID is a field or flag on any custom field of type Text, Number or Email
External ID is Case INSENSITIVE
External ID are restricted to Three ID fields per object
External ID can be Custom fields only.
168. What are Relative Dates?
Related dates are dates used in Views and Reports for filtering.
These are dynamic date range, based on current date
Examples: This Week, Next Month, Last 90 Days
Available Relative Date Filters (not case sensitive)
• Today
• Yesterday
• Tomorrow
• This Week
• Last Week
• Next Week
• This Month
• Last Month
• Next Month
• Last x Days
• Next x Days
• Quarter
• Year
• Fiscal Quarter
• Fiscal Year
169. How is Role Different from the Profile?
Roles and Profiles are two different concepts in Salesforce.com, Some of the basic differences are:
• Profile helps to put restrictions on the Object where as the Role helps in opening the records to the users above the Role hierarchy
• Profile manages the Salesforce.com License, Tabs Settings, Record types, Page layouts, General Settings, Administrator Settings etc; Role hierarchy does not do any of these things
• Profile is Mandatory, Role is not
170. What are the different ways of making a field mandatory?
In salesforce we can make fields mandatory by 3 ways
1. Page Layout: - Field can be made mandatory from the page layout when it needs to be made mandatory for a set of users
2. Field Level Security: - Field can be made mandatory from the FLS when it needs to be made mandatory for all the users in the Organization and even from the API’s
3. Validation Rule: - Field can be made mandatory from the Validation Rule when it needs to be made mandatory for user who is using the same Page layout used by other users
Salesforce.com recommends using the Page Layout option for making the field mandatory.
171. What are the Different Ways in which leads can be created in salesforce.com?
Some of the ways in which leads can be generated and created in salesforce.com are
• Walk In to a company: User comes to the company office and then Salesforce.com rep manually creates the Lead
• Data Base bought by the company and then leads loaded via Data Loader/Import Wizard in salesforce.com
• Leads created because of the Campaigns, Seminars, and Tradeshows
• Web to Lead: Users registering on the website of the company.
• Email to Lead & SMS to Lead can be custom build for the Organization
172. Can a Contact be part of Partner Portal as well as Customer Portal in salesforce.com?
Yes, a contact can be part of a Partner Portal as well as Customer portal in salesforce.com.
Customer Portal and Partner portal depend on the user object and are not related to the contact object.
So to enable both portals for a Contact we need to create two users which will utilize two different salesforce.com licenses, one license for Customer portal and other for Partner portal.
Both users created for a same contact will have two different profiles, One for Customer portal and other for Partner Portal.
173. When are the Record types used?
Record Types are used in the following two cases
• To assign the different Page layouts to different users based on their profiles
• To enable different sets of Standard/Custom Picklist values for two different users using the same page layout
174. What are Profile Components?
Profiles Components:
• Which standard and custom apps users can view
• Which tabs users can view
• Which record types are available to users
• Which page layouts users see
• Object permissions that allow users to create, read, edit, and delete records
• Which fields within objects users can view and edit
• Permissions that allow users to manage the system and apps within it
• Which Apex classes and Visualforce pages users can access
• Which desktop clients users can access
• The hours during which and IP addresses from which users can log in
• Which service providers users can access (if Salesforce is enabled as an identity provider)
175. Explain Profile Vs Permission Sets Permissions and Access Settings?
The following table shows the types of permissions and access settings that are specified in profiles and permission sets. Some profile settings aren’t included in permission sets.
Permission or Setting Type In Profiles? In Permission Sets?
Assigned apps TRUE TRUE
Tab settings TRUE TRUE
Record type assignments TRUE
Page layout assignments TRUE
Object permissions TRUE TRUE
Field permissions TRUE TRUE
User permissions (app and system) TRUE TRUE
Apex class access TRUE TRUE
Visualforce page access TRUE TRUE
Service provider access (if Salesforce is enabled as an identity provider) TRUE TRUE
Desktop client access TRUE
Login hours TRUE
Login IP ranges TRUE
176. What are the Standard Profiles available in Salesforce?
There are Six (6) Standard Profiles available in salesforce (EE/UE and PE)
• Standard User – Can view, edit, and delete their own records
• Solution Manager – Standard User permissions + Can manage published solutions + Can manage categories
• Marketing User – Standard User permissions + Can import leads for the organization
• Contract Manager – Standard User permissions + Can edit, approve, activate, and delete contracts
• Read-Only – Can only view records
• System Administrator – “Super User,” can customize and administer the application
177. What are Standard Business Objects?
Standard Business objects are mentioned below.
Object Description
Campaigns A Campaign is any marketing project that you want to plan, manage, and track in Salesforce.
Leads A Lead is any person, organization or company that may be interested in your products. Sometimes Leads are referred to as Prospects or Suspects. Leads are not yet customers.
Accounts An Account is an organization, individual or company involved with your business such as customers, competitors and partners that you wish to track in Salesforce
Contacts A Contact is any individual or influencer associated with an account that you want to track in Salesforce
Opportunities An Opportunity is any potential revenue-generating event (“sales deal” ) that you want to
track in Salesforce
Cases A case is a detailed description of a customer’s feedback, problem or question
Solutions A solution is a detailed description of a customer issue and the resolution of that issue. The
collection of your organization’s solutions is sometimes referred to as the solution knowledge base
Forecasts A forecast is your best estimate of how much revenue you can generate in a quarter
Documents
Reports Reports are summaries and analyses of your data, which you can display or print
Dashboards Dashboards give you a real-time snapshot of corporate metrics and key performance
indicators. A dashboard is a group of different charts (or components) that graphically display your custom
report data
Calendar and Task Activities are both tasks and scheduled calendar events. You can define and track activities for many different objects, including campaigns, accounts, contacts, and leads
Products Products are the individual items that you sell on your opportunities. (Please note that Products are available in EE/UE and Developer and in PE for an additional fee.)
178. What is a Company Profile?
Company profile contains core information for your company.
Below are the key information includes in company profile
• Language, Locale and Time Zone
• Licenses
• Storage and Used Space
• Fiscal Year
• Primary Contact and Address information
• Manage Currencies
179. What is a Fiscal Year in Salesforce?
Financial year in salesforce is used for an organizations financial planning.
This is usually a year in length and impacts forecasts, quotas and reports
Salesforce allows two types:
• Standard Fiscal Years are periods that follow the Gregorian calendar, but can start on the first day of any month of the year. (A Gregorian Year is a calendar based on a 12 Month Structure and is used throughout
much of the world.)
• Custom Fiscal Years are for companies that break down their fiscal years, quarters and weeks in to custom fiscal periods based on their financial planning requirements.
180. Can we use Custom financial year in forecasting?
We can NOT use Custom financial year in forecasting. But Customizable Forecasting must be enabled for use with Custom Fiscal Years
There is an Email log that you could use. It’s available in the setup menu under Monitoring.
It’s only for the past 30 days and you would have to manually check it.
From the email log page: “Email logs describe all emails sent through salesforce.com and can be used to help identify the status of an email delivery. Email logs are CSV files that provide information such as the email address of each email sender and its recipient, the date and time each email was sent, and any error code associated with each email. Logs are only available for the past 30 days.”
182. In salesforce which fields are indexed automatically?
The following fields are indexed by default:
• primary keys (Id, Name and Owner fields),
• foreign keys (lookup or master-detail relationship fields),
• audit dates (such as LastModifiedDate),
• Custom fields marked as External ID or Unique
183. Give any scenario when you cannot change the currency field type to numeric type.
When the field is used either in Apex class or trigger
184. Consider a scenario where you have created a Visualforce page and Controller. You want to restrict the controller action for users which are logged in using “Grant Login Access”. How to achieve this?
When System admin logged in on the behalf of any other user, On upper right corner message is displayed that user is logged-in on behalf of some other user. In Visualforce page we can search for the element with class name present or not? If the element with that Class name exist means logged-in user is not an actual user.
185. How to get the debug log of Connection user in salesforce to salesforce Integration?
When configuring Debug Logs, you cannot choose a Salesforce to Salesforce Connection User from the User Lookup, but there is a workaround to achieve this.
To begin capturing Debug Logs for a Connection User open the following URL in your browser:
https://XXX.salesforce.com/p/setup/layout/AddApexDebugLogUser?retURL=%2Fsetup%2Fui%2FlistApexTraces.apexp&UserLookupInput_lkid=YYYYYYYYYYYYYY
&UserLookupInput=Connection%20User
Replace XXX with your salesforce instance, UserLookupInput_lkid is the ID of the Connection User and UserLookupInput is the User name. You can find the user ID of the connection user, by inspecting the CreatedById for a record created by this user. (eg. via eclipse or Force.com explorer)
186. 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?
Even after deactivation of workflow, its action will be active in queue.
187. We have “Time Based Workflow” and there is action scheduled to be executed. Can we delete that workflow?
If a workflow has any pending time dependent action, then we cannot delete the workflow.
188. How to clear the Time based workflow action queue?
Two ways to achieve this:
1. Make criteria false for all those records.
2. Navigate to “Set up | Monitoring | Time Based Workflow”, search for scheduled actions and remove from queue.
189. While creating workflow on Task, what difference observed on available actions?
“Send Email” action is not available while creating workflow on task.
190. When loading data into date fields such as Opportunity Close Date using the Data Loader, the date displayed in the application is sometimes one day earlier than the date in the file. What may be the reason and solution?
The reason for this is that fields such as Close Date are actually date/time fields. When a date is loaded without specifying the time, the time is defaulted to 00:00 – midnight. When another user is in a time zone which is behind the current user’s time zone, the date will show on the previous day.
For example:
20 August 2008 00:00 in Paris is 19 August 2008 23:00 in London
Similar issues can arise when daylight savings time begins or ends.
Two simple solutions to this are:
1) Specify a time as well as a date when loading dates using the Data Loader. Or
2) Switch your PC’s time zone to Hawaiian time before starting up the Data Loader.
191. Explain dynamic Dashboard.
Dashboard which is running under current logged in user permission is known as “dynamic Dashboard”. At the most 3 dynamic dashboards can be built. This is available in Unlimited, Enterprise and Developer edition. This type of dashboard cannot be scheduled for refresh. IT must be scheduled manually.
192. What is analytic Snapshot in salesforce?
Analytic snapshot capture and store the data at pre decided intervals. It captures data from report and saves in custom object as per schedule. It only supports tabular and summary report as asource report. It does not support matrix report. The field type in target object must be same as source report object field.
193. What are the features of “Manage Members” in campaign records?
Campaign members are created from lead, contact, or person account records. Salesforce provides a variety of ways in which you can manage your campaign members. You can add and update up to 50,000 campaign members at a time through lead, contact, and person account reports; you can search for and add or edit multiple leads and contacts from the Manage Members page; you can add an unlimited number of leads and contacts using a CSV import file; or you can add members to a campaign one at a time from contact or lead detail pages.
194. If I want Object level accesses then what should i use from Salesforce security model?
Profile
195. In OWD (Organization wide sharing), can I change the setting “Grant Access Using Hierarchies” for Standard Objects?
You cannot change it for Standard Objects However for Custom Objects it’s possible.
196. What is Mandatory while creating User, Role or Profile?
It’s Profile.
197.In case of Master-Detail relationship, on Update of master record can we update the field of child record using workflow rule?
No
198. In case of Master-Detail relationship, on Update of child record can we update the field of Parent record using workflow rule?
Yes, Master Fields are also available for “Criteria evaluation”.
199. While setting OWD (Organization wide sharing), can we change/modify the setting of child record in case of Master-Detail relationship?
No, Child record is controlled by the Parents setting.
200. How to hide the “App Setup” Menu from user’s setup page?
In Profile, remove access “View Setup and Configuration”.
201. While creating new profile for user, which existing profile should be copied?
If the new user is not System administrator then copy from “Standard User” profile.
202. Who can run reports?
Users with permission “Run Report” and access to report folder can only run the report.
203. What is Difference between “Printable View” and “Export Details“button on report?
Printable View:
Formatting, grouping and subtotals are persisted.
Export Details:
Formatting, grouping and subtotals are lost.
204. What is the use of “floating report header”?
If you have long tabular report, you can make the column header visible on each page as you scroll, by enabling floating report headers.
205. How to enable “floating report header”?
Go to “Setup | App Setup | Customize | Report and Dashboard | User Interface Settings“.
Click on checkbox “Enable Floating Report Headers”.
206. Which permission is required to set the running user other than you in dashboard?
“View All Data” in profile.
207. Who can access “drag and drop dashboard”?
User with permission “manage dashboard”.
208. Which type of report can be used for dashboard components?
Summary and matrix report.
209. How many types of dashboard components are available?
Chart, Table, Metric, Gauge, and Visualforce
210. What is the difference between External ID and Unique ID?
External ID
This is a field that usually references an ID from another (external) system. For instance, if the customer has an Oracle Financials system that they will be linking with salesforce.com, it may be easier for them to be able to refer to the Oracle ID of account records from within salesforce. So they would create an external ID in salesforce.com and they would load the Oracle ID into that field for each account. They can then refer to that ID field, rather than the salesforce.com id.
Additionally, if you have an external ID field, the field becomes searchable in the sidebar search. You also can use the upsert API call with the extenal ID to refer to records.
You can have multiple records with the same external ID (though it is not recommended, as it will defeat the purpose of the external id).
External Id available for Text, Number and Email field types
External Id is used in upsert operations.
• If external id is absent or not matched then insert happens.
• If external id matched once then record will be updated.
• If external id is matched multiple times then error occurs.
Unique ID field
This is a setting for the field that will prevent you from using the same value in multiple records for the unique field. So if I create a 5 character text field and make it unique, and I create a record with the value “12345″ it will not be able to create another record with that same value in the unique field. If I try to do so, I will get an error saying that the value is already in use.
Often, External Ids are set with the unique property so that the IDs will be unique to each record.
211. In Profile settings, what is difference between “Modify All Data” and “Modify All”?
Modify All Data: Create, edit, and delete all organization data, regardless of sharing settings.
Modify All: Give Read, Add, Delete permission to selected Object, Create permission is not included in Modify All permission.
212. Explain Permission sets?
A permission set is a collection of settings and permissions that give users access to various tools and functions. The settings and permissions in permission sets are also found in profiles, but permission sets extend users’ functional access without changing their profiles.
For example, to give users access to a custom object, create a permission set, enable the required permissions for the object, and assign the permission set to the users. You never have to change profiles, or create a profile for a single use case. While users can have only one profile, they can have multiple permission sets.
Permission sets include settings for:
• Assigned apps
• Object settings, which include:
• Tab settings
• Object permissions
• Field permissions
• App permissions
• Apex class access
• Visualforce page access
• System permissions
• Service providers (only if you’ve enabled Salesforce as an identity provider)
213. What is Master Detail relationship and look up relationship in Salesforce?
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, COUNT, MIN, MAX of the Child records.
Look up relationship is something like “has-a” (Containership) relationship, where one record has reference to other records. When one record is deleted then there is no impact on other records.
214. Can we convert the lookup relationship to Master Detail relationship?
We can convert the lookup relationship to master detail relationship if and only if all the existing record has valid lookup field.
215. How to delete the User from Salesforce?
As per now, salesforce does not allow deleting any user; however you can deactivate the user.
216. How to delete Users data from Salesforce?
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.
217. How to restrict the user to see any record let’s say opportunity?
Set up opportunity sharing to be private. If both users are admins or have view all records on opportunity, then that overrides private sharing.
218. What is difference between WhoId and WhatId in the Data Model of Task ?
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
219. Where is the option of the report for the “Custom Object with related object” and what are the conditions to generate related reports?
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 enabled
• The relationship between both of them must be “Master – detail relationship”.
220. How you can provide the User Login (Authentication) in Public sites created by Salesforce?
We can provide the authentication on public sites using “Customer Portal”.
221. What is the dynamic Apex?
Dynamic Apex enables developers to create more flexible applications by providing them with the ability to “Access sObject and field describe information”, “Write Dynamic SOQL Queries”, “Write Dynamic SOSL Queries” and “Dynamic DML”.
222. 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 sandbox organization. In a Salesforce.com production organization, you can only make changes to Apex by using the Metadata API, deploy, call, 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.
223. 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.
If the new user is not System administrator then copy from “Standard User” profile.
202. Who can run reports?
Users with permission “Run Report” and access to report folder can only run the report.
203. What is Difference between “Printable View” and “Export Details“button on report?
Printable View:
Formatting, grouping and subtotals are persisted.
Export Details:
Formatting, grouping and subtotals are lost.
204. What is the use of “floating report header”?
If you have long tabular report, you can make the column header visible on each page as you scroll, by enabling floating report headers.
205. How to enable “floating report header”?
Go to “Setup | App Setup | Customize | Report and Dashboard | User Interface Settings“.
Click on checkbox “Enable Floating Report Headers”.
206. Which permission is required to set the running user other than you in dashboard?
“View All Data” in profile.
207. Who can access “drag and drop dashboard”?
User with permission “manage dashboard”.
208. Which type of report can be used for dashboard components?
Summary and matrix report.
209. How many types of dashboard components are available?
Chart, Table, Metric, Gauge, and Visualforce
210. What is the difference between External ID and Unique ID?
External ID
This is a field that usually references an ID from another (external) system. For instance, if the customer has an Oracle Financials system that they will be linking with salesforce.com, it may be easier for them to be able to refer to the Oracle ID of account records from within salesforce. So they would create an external ID in salesforce.com and they would load the Oracle ID into that field for each account. They can then refer to that ID field, rather than the salesforce.com id.
Additionally, if you have an external ID field, the field becomes searchable in the sidebar search. You also can use the upsert API call with the extenal ID to refer to records.
You can have multiple records with the same external ID (though it is not recommended, as it will defeat the purpose of the external id).
External Id available for Text, Number and Email field types
External Id is used in upsert operations.
• If external id is absent or not matched then insert happens.
• If external id matched once then record will be updated.
• If external id is matched multiple times then error occurs.
Unique ID field
This is a setting for the field that will prevent you from using the same value in multiple records for the unique field. So if I create a 5 character text field and make it unique, and I create a record with the value “12345″ it will not be able to create another record with that same value in the unique field. If I try to do so, I will get an error saying that the value is already in use.
Often, External Ids are set with the unique property so that the IDs will be unique to each record.
211. In Profile settings, what is difference between “Modify All Data” and “Modify All”?
Modify All Data: Create, edit, and delete all organization data, regardless of sharing settings.
Modify All: Give Read, Add, Delete permission to selected Object, Create permission is not included in Modify All permission.
212. Explain Permission sets?
A permission set is a collection of settings and permissions that give users access to various tools and functions. The settings and permissions in permission sets are also found in profiles, but permission sets extend users’ functional access without changing their profiles.
For example, to give users access to a custom object, create a permission set, enable the required permissions for the object, and assign the permission set to the users. You never have to change profiles, or create a profile for a single use case. While users can have only one profile, they can have multiple permission sets.
Permission sets include settings for:
• Assigned apps
• Object settings, which include:
• Tab settings
• Object permissions
• Field permissions
• App permissions
• Apex class access
• Visualforce page access
• System permissions
• Service providers (only if you’ve enabled Salesforce as an identity provider)
213. What is Master Detail relationship and look up relationship in Salesforce?
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, COUNT, MIN, MAX of the Child records.
Look up relationship is something like “has-a” (Containership) relationship, where one record has reference to other records. When one record is deleted then there is no impact on other records.
214. Can we convert the lookup relationship to Master Detail relationship?
We can convert the lookup relationship to master detail relationship if and only if all the existing record has valid lookup field.
215. How to delete the User from Salesforce?
As per now, salesforce does not allow deleting any user; however you can deactivate the user.
216. How to delete Users data from Salesforce?
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.
217. How to restrict the user to see any record let’s say opportunity?
Set up opportunity sharing to be private. If both users are admins or have view all records on opportunity, then that overrides private sharing.
218. What is difference between WhoId and WhatId in the Data Model of Task ?
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
219. Where is the option of the report for the “Custom Object with related object” and what are the conditions to generate related reports?
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 enabled
• The relationship between both of them must be “Master – detail relationship”.
220. How you can provide the User Login (Authentication) in Public sites created by Salesforce?
We can provide the authentication on public sites using “Customer Portal”.
221. What is the dynamic Apex?
Dynamic Apex enables developers to create more flexible applications by providing them with the ability to “Access sObject and field describe information”, “Write Dynamic SOQL Queries”, “Write Dynamic SOSL Queries” and “Dynamic DML”.
222. 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 sandbox organization. In a Salesforce.com production organization, you can only make changes to Apex by using the Metadata API, deploy, call, 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.
223. 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.
224. What are the types of email templates available in salesforce.com?
1. Text
2. HTML with Letter Head
3. Custom HTML
4. Visual force
You can create four different types of email templates:
1) Text – All users can create or change text email templates.
2) HTML with letterhead – Administrators and users with the “Edit HTML Templates” permission can create HTML email templates based on a letterhead.
3) Custom HTML – Administrators and users with the “Edit HTML Templates” permission can create custom HTML email templates without using a letterhead. You must either know HTML or obtain the HTML code to insert in your email template.
4) Visualforce – Administrators and developers can create templates using Visualforce. Visualforce email templates allow for advanced merging with a recipient’s data, where the content of a template can contain information from multiple records.
225. 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.
226. Can we create Roll up summary fields on child object of a Master-Detail relationship?
No, Roll up summary fields can only be created on the master object of the Master-Detail relationship
227. 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.
228. How many types of the relationship fields available in Salesforce?
There are Four types of the Relationship fields available in Salesforce
1. Master Detail
2. Many to Many
3. Lookup
4. Hierarchical (It is available only on User Object, we cannot create this relationship)
229. What are Apex Governor Limits?
Governor limits are runtime limits enforced by the Apex runtime engine. Because Apex runs in a shared, multitenant environment, the Apex runtime engine strictly enforces a number of limits to ensure that code does not monopolize shared resources. Types of limits that Apex enforces are resources like memory, database resources, number of script statements to avoid infinite loops, and number of records being processed. If code exceeds a limit, the associated governor issues a runtime exception.
230. Difference between Sandbox and Development environment?
Sandbox
The salesforce.com Sandbox environment is an exact copy of your salesforce.com instance. You can copy your live instance to a sandbox environment (but you have to perform manually from sandbox to developer edition) where you can test any changes, implementations, AppExchangeapps or updates. It can also be your hands-on training environment without risking your live data.
You can either copy your configuration and data into a sandbox environment or just the configuration. It acts exactly like your live instance, but be careful if you have workflow rules or automations because they will work in the sandbox as well.
I know that this sounds wonderful and if you don’t have it, you are dying to know how to get it. The problem is the cost. If you are on Unlimited Edition, then cost is not a problem because it comes included. But for Enterprise, Professional or Group Editions, you have to pay… and the price is hefty; anywhere between 25k-50k per year. For a lot of companies, that is more than they are paying for their live salesforce.com instance. So how do you test salesforce.com without Sandbox? It is always suggested to develop application in sandbox instance then go for LIVE.
Developer Edition
Developer Edition was an edition created for development of integrations and apps, specifically for the AppExchange. It is also a great tool for testing/training in salesforce.com. What makes this a great tool is the fact that it is free. Anyone can get a Developer Edition of salesforce.com. It is a standard Enterprise Edition with very limited storage space. You cannot copy your configuration or data onto the Developer Edition, but you can customize it to match your instance’s look and feel. Once it is customized, you can use it for training, testing or anything else you want. It takes a little bit of work, but you can make it act and feel just like your live instance. The work is well worth it for the free price.
231. How to schedule export or take the backup of salesforce?
Step by Step Instruction:
Click Setup >Data Management > Data Export > Schedule Export.
Select the desired encoding for your export file. Leaving the default is fine.
Check the Include in export checkbox if you want to include attachments in the export (optional)
Leave the default Replace carriage returns with spaces if you want your export files to have spaces instead of carriage returns.
Select Weekly as the frequency for the exports.
Choose start and end dates. Set the end date to sometime in the distant future such as 20 years from the begin date.
Set the time of day for your scheduled export. The export is put in a job queue and the exact time of the export will depend on the amount of activity in the queue.
You can select the types of data to include in your export. It is best to include all data in your export file. This will make sure all your organizations data is exported.
Click Save.
Points to Remember:
Formula and roll-up summary fields are never included in exports.
Articles are not included from exports.
The export notification email is sent to the email address on file for the user who created the scheduled export. There is no way to indicate another email address. If as an Administrator you want the email to go to another person, have them grant you login access, login as them and schedule the data export.
Important:
Scheduled backup exports of your data are limited to weekly exports.
You have 48 hours from the time you are notified the backup is available to download the backup file.
The email notification for backups goes to the email address in Salesforce of the person logged in who schedules the backup
232. Do governor limits apply to sandbox instances?
Governor limits do apply to all Salesforce instances (trial, developer, and production or sandbox environments). However code coverage and successful execution of test classes is only enforced when deploying to a production environment.
233. What actions can be performed using Workflows?
Following workflow actions can be performed in a workflow:
1. Email Alert:
Email alerts are workflow and approval actions that are generated using an email template by a workflow rule or approval process and sent to designated recipients, either Salesforce users or others. Workflow alerts can be sent to any user or contact, as long as they have a valid email address.
2. Field Update:
Field updates are workflow and approval actions that specify the field you want updated and the new value for it. Depending on the type of field, you can choose to apply a specific value, make the value blank, or calculate a value based on a formula you create.
3. Task:
Assigns a task to a user you specify. You can specify the Subject, Status, Priority, and Due Date of the task. Tasks are workflow and approval actions that are triggered by workflow rules or approval processes.
4. Outbound Message:
An outbound message is a workflow, approval, or milestone action that sends the information you specify to an endpoint you designate, such as an external service. An outbound message sends the data in the specified fields in the form of a SOAP message to the endpoint.
234. How to delete an apex class or trigger in salesforce.com production environment?
In salesforce.com production environment the Del option is not displayed for classes & triggers. Follow the below steps to delete file in production:
• Go to your sandbox (where you do your Trigger/Class development) and delete the Trigger/Class from there. Also delete the Test Methods that test the Class/Trigger.
• Go to Eclipse and do a Refresh from Server. This will make the files disappear within Eclipse.
• Then deploy to Production, ticking Delete next to the files in your Deployment Plan. (For safety, always Deselect All when deploying, then sort by Type. Only then tick which files to deploy, since choosing the wrong ones could cripple Production.)
235. What are governor limits in Salesforce.com?
Governor limits are runtime limits enforced by the Apex runtime engine. Because Apex runs in a shared, multitenant environment, the Apex runtime engine strictly enforces a number of limits to ensure that code does not monopolize shared resources. Types of limits that Apex enforces are resources like memory, database resources, number of script statements to avoid infinite loops, and number of records being processed. If code exceeds a limit, the associated governor issues a runtime exception that cannot be handled thereby terminating the request.
For more information please refer to the link:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm
236. Which objects can be imported by Import Wizard?
Following objects can be imported using import wizard.
1. Accounts
2. Contacts
3. Leads
4. Solutions
5. Custom Objects
237. What is the difference between Role & Profile in salesforce.com?
Profile:
Profiles are set of permissions and setting which determines the objects, the fields of the object, tabs & apps the user can access. It also determines the page layout & record type accessible to the user. Profile is a required field while user creation.
Role:
Role control the level of visibility/access to organization’s data at the record level. Users at any given role can view, edit & report on data accessible to all the users below them in role hierarchy. Role is not a required field while user creation.
Example:
Let’s take an example of a software company Ajanya.com. It has two profiles Developer & Tester and two roles Trainee & Manager. Let’s consider that Defect is a custom object.
By using Profile we can ensure that Defect can by created only by user with Tester profile and User with Developer profile can only edit the defect description.
By using Roles we can ensure that the user with Profile Developer & Role Manager can view the Defects assigned to user with profile Developer & Role Trainee.
238. What are different portals in Salesforce.com?
Partner Portal:
A partner portal allows partner users to log in to Salesforce.com through a separate website than non-partner users. Partner users can only view & edit data that has been made available to them. An organization can have multiple partner portals.
For partner portal best practices please refer link:
https://ap1.salesforce.com/help/doc/en/partner_portal_best_practices.htm
Customer Portal:
Customer Portal provides an online support channel for customers allowing them to resolve their inquiries without contacting a customer service representative. An organization can have multiple customer portals.
239. What is the use of Salesforce.com Sites?
Force.com Sites enables you to create public websites and applications that are directly integrated with your Salesforce organization without requiring users to log in with a username and password. You can publicly expose any information stored in your organization through a branded URL of your choice. Sites are hosted on Force.com servers and built on native Visualforce pages. You can user authentication to a public site using customer portal.
240. How to import attachments using Data Loader in salesforce?
Please follow the instructions below.
1. Create an AttachmentList.csv file with the following column headers:
• ParentId - ID of the record to which the attachment should be associated
• Name - Name of the attachment
• ContentType - Format of the extension (e.g. .xls, .pdf, etc)
• OwnerID - ID for the owner of the attachment
• Body - File path to the Attachment on your local machine (C:\Attachments\FileName.pdf)
2. Log in to the Data Loader.
3. Select the "Insert" command.
4. In the 'Select Sforce Object' step, select the ‘Attachments’ object. This object is not displayed by default hence check the ‘Show all Sforce Objects' checkbox.
5. Choose the AttachmentList.csv file.
6. In the mapping step, map the following fields:
• Parent ID
• Name
• Owner ID
• Body - Make sure to map the Body column which you created previously with the file extension. This is how you designate the file and location of the attachments to be inserted.
7. Click "OK" to start the upload.
241. What are groups in SFDC and what is their use in salesforce?
Groups are set of users. They can contain individual users, other groups, the users in a particular role or territory, or the users in a particular role or territory plus all of the users below that role or territory in the hierarchy.
There are two types of groups:
• Public groups: Only administrators can create public groups. They can be used by everyone in the organization.
• Personal groups: Each user can create groups for their personal use.
You can use groups in the following ways:
• To set up default sharing access via a sharing rule
• To share your records with other users
• To specify that you want to synchronize contacts owned by others users
• To add multiple users to a Salesforce CRM Content library
• To assign users to specific actions in Salesforce Knowledge
242. What is the difference between public cloud & private cloud in salesforce? Is salesforce.com a public cloud or private cloud?
Public Cloud: Could services are provided "as a service" over the Internet with little or no control over the underlying technology infrastructure. More than one tenant can use the same resources.
Private Cloud: This also offers activities and functions "as a service" but is deployed over a company intranet or hosted datacenter. This is private product for a company or organization offering advance security.
Salesforce.com: Is a public cloud as it is hosted on salesforce.com data centers and data of more than one tenant resides on same servers.
243. What is the difference between custom controller and extension in salesforce?
Custom Controller: A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.
Controller extension: A controller extension is an Apex class that extends the functionality of a standard or custom controller. Use controller extensions when:
• You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete.
• You want to add new actions.
• You want to build a Visualforce page that respects user permissions. Although a controller extension class executes in system mode, if a controller extension extends a standard controller, the logic from the standard controller does not execute in system mode. Instead, it executes in user mode, in which permissions, field-level security, and sharing rules of the current user apply.
A controller extension is any Apex class containing a constructor that takes a single argument of type ApexPages.StandardController or CustomControllerName, whereCustomControllerName is the name of a custom controller you want to extend.
Note: Although custom controllers and controller extension classes execute in system mode and thereby ignore user permissions and field-level security, you can choose whether they respect a user's organization-wide defaults, role hierarchy, and sharing rules by using the with sharing keywords in the class definition.
244. What are different kinds of reports?
1. Tabular: Tabular reports are the simplest and fastest way to look at data. Similar to a spreadsheet, they consist simply of an ordered set of fields in columns, with each matching record listed in a row. Tabular reports are best for creating lists of records or a list with a single grand total. They can't be used to create groups of data or charts, and can't be used in dashboards unless rows are limited. Examples include contact mailing lists and activity reports.
2. Summary: Summary reports are similar to tabular reports, but also allow users to group rows of data, view subtotals, and create charts. They can be used as the source report for dashboard components. Use this type for a report to show subtotals based on the value of a particular field or when you want to create a hierarchical list, such as all opportunities for your team, subtotaled by Stage and Owner. Summary reports with no groupings show as tabular reports on the report run page.
3. Matrix: Matrix reports are similar to summary reports but allow you to group and summarize data by both rows and columns. They can be used as the source report for dashboard components. Use this type for comparing related totals, especially if you have large amounts of data to summarize and you need to compare values in several different fields, or you want to look at data by date and by product, person, or geography. Matrix reports without at least one row and one column grouping show as summary reports on the report run page.
4. Joined: Joined reports let you create multiple report blocks that provide different views of your data. Each block acts like a “sub-report,” with its own fields, columns, sorting, and filtering. A joined report can even contain data from different report types.
245. What are different kinds of dashboard component?
1. Chart: Use a chart when you want to show data graphically.
2. Gauge: Use a gauge when you have a single value that you want to show within a range of custom values.
3. Metric: Use a metric when you have one key value to display.
• Enter metric labels directly on components by clicking the empty text field next to the grand total.
• Metric components placed directly above and below each other in a dashboard column are displayed together as a single component.
4. Table: Use a table to show a set of report data in column form.
5. Visualforce Page: Use a Visualforce page when you want to create a custom component or show information not available in another component type
6. Custom S-Control: Custom S-Controls can contain any type of content that you can display or run in a browser, for example, a Java applet, an ActiveX control, an Excel file, or a custom HTML Web form\
1. Text
2. HTML with Letter Head
3. Custom HTML
4. Visual force
You can create four different types of email templates:
1) Text – All users can create or change text email templates.
2) HTML with letterhead – Administrators and users with the “Edit HTML Templates” permission can create HTML email templates based on a letterhead.
3) Custom HTML – Administrators and users with the “Edit HTML Templates” permission can create custom HTML email templates without using a letterhead. You must either know HTML or obtain the HTML code to insert in your email template.
4) Visualforce – Administrators and developers can create templates using Visualforce. Visualforce email templates allow for advanced merging with a recipient’s data, where the content of a template can contain information from multiple records.
225. 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.
226. Can we create Roll up summary fields on child object of a Master-Detail relationship?
No, Roll up summary fields can only be created on the master object of the Master-Detail relationship
227. 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.
228. How many types of the relationship fields available in Salesforce?
There are Four types of the Relationship fields available in Salesforce
1. Master Detail
2. Many to Many
3. Lookup
4. Hierarchical (It is available only on User Object, we cannot create this relationship)
229. What are Apex Governor Limits?
Governor limits are runtime limits enforced by the Apex runtime engine. Because Apex runs in a shared, multitenant environment, the Apex runtime engine strictly enforces a number of limits to ensure that code does not monopolize shared resources. Types of limits that Apex enforces are resources like memory, database resources, number of script statements to avoid infinite loops, and number of records being processed. If code exceeds a limit, the associated governor issues a runtime exception.
230. Difference between Sandbox and Development environment?
Sandbox
The salesforce.com Sandbox environment is an exact copy of your salesforce.com instance. You can copy your live instance to a sandbox environment (but you have to perform manually from sandbox to developer edition) where you can test any changes, implementations, AppExchangeapps or updates. It can also be your hands-on training environment without risking your live data.
You can either copy your configuration and data into a sandbox environment or just the configuration. It acts exactly like your live instance, but be careful if you have workflow rules or automations because they will work in the sandbox as well.
I know that this sounds wonderful and if you don’t have it, you are dying to know how to get it. The problem is the cost. If you are on Unlimited Edition, then cost is not a problem because it comes included. But for Enterprise, Professional or Group Editions, you have to pay… and the price is hefty; anywhere between 25k-50k per year. For a lot of companies, that is more than they are paying for their live salesforce.com instance. So how do you test salesforce.com without Sandbox? It is always suggested to develop application in sandbox instance then go for LIVE.
Developer Edition
Developer Edition was an edition created for development of integrations and apps, specifically for the AppExchange. It is also a great tool for testing/training in salesforce.com. What makes this a great tool is the fact that it is free. Anyone can get a Developer Edition of salesforce.com. It is a standard Enterprise Edition with very limited storage space. You cannot copy your configuration or data onto the Developer Edition, but you can customize it to match your instance’s look and feel. Once it is customized, you can use it for training, testing or anything else you want. It takes a little bit of work, but you can make it act and feel just like your live instance. The work is well worth it for the free price.
231. How to schedule export or take the backup of salesforce?
Step by Step Instruction:
Click Setup >Data Management > Data Export > Schedule Export.
Select the desired encoding for your export file. Leaving the default is fine.
Check the Include in export checkbox if you want to include attachments in the export (optional)
Leave the default Replace carriage returns with spaces if you want your export files to have spaces instead of carriage returns.
Select Weekly as the frequency for the exports.
Choose start and end dates. Set the end date to sometime in the distant future such as 20 years from the begin date.
Set the time of day for your scheduled export. The export is put in a job queue and the exact time of the export will depend on the amount of activity in the queue.
You can select the types of data to include in your export. It is best to include all data in your export file. This will make sure all your organizations data is exported.
Click Save.
Points to Remember:
Formula and roll-up summary fields are never included in exports.
Articles are not included from exports.
The export notification email is sent to the email address on file for the user who created the scheduled export. There is no way to indicate another email address. If as an Administrator you want the email to go to another person, have them grant you login access, login as them and schedule the data export.
Important:
Scheduled backup exports of your data are limited to weekly exports.
You have 48 hours from the time you are notified the backup is available to download the backup file.
The email notification for backups goes to the email address in Salesforce of the person logged in who schedules the backup
232. Do governor limits apply to sandbox instances?
Governor limits do apply to all Salesforce instances (trial, developer, and production or sandbox environments). However code coverage and successful execution of test classes is only enforced when deploying to a production environment.
233. What actions can be performed using Workflows?
Following workflow actions can be performed in a workflow:
1. Email Alert:
Email alerts are workflow and approval actions that are generated using an email template by a workflow rule or approval process and sent to designated recipients, either Salesforce users or others. Workflow alerts can be sent to any user or contact, as long as they have a valid email address.
2. Field Update:
Field updates are workflow and approval actions that specify the field you want updated and the new value for it. Depending on the type of field, you can choose to apply a specific value, make the value blank, or calculate a value based on a formula you create.
3. Task:
Assigns a task to a user you specify. You can specify the Subject, Status, Priority, and Due Date of the task. Tasks are workflow and approval actions that are triggered by workflow rules or approval processes.
4. Outbound Message:
An outbound message is a workflow, approval, or milestone action that sends the information you specify to an endpoint you designate, such as an external service. An outbound message sends the data in the specified fields in the form of a SOAP message to the endpoint.
234. How to delete an apex class or trigger in salesforce.com production environment?
In salesforce.com production environment the Del option is not displayed for classes & triggers. Follow the below steps to delete file in production:
• Go to your sandbox (where you do your Trigger/Class development) and delete the Trigger/Class from there. Also delete the Test Methods that test the Class/Trigger.
• Go to Eclipse and do a Refresh from Server. This will make the files disappear within Eclipse.
• Then deploy to Production, ticking Delete next to the files in your Deployment Plan. (For safety, always Deselect All when deploying, then sort by Type. Only then tick which files to deploy, since choosing the wrong ones could cripple Production.)
235. What are governor limits in Salesforce.com?
Governor limits are runtime limits enforced by the Apex runtime engine. Because Apex runs in a shared, multitenant environment, the Apex runtime engine strictly enforces a number of limits to ensure that code does not monopolize shared resources. Types of limits that Apex enforces are resources like memory, database resources, number of script statements to avoid infinite loops, and number of records being processed. If code exceeds a limit, the associated governor issues a runtime exception that cannot be handled thereby terminating the request.
For more information please refer to the link:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_gov_limits.htm
236. Which objects can be imported by Import Wizard?
Following objects can be imported using import wizard.
1. Accounts
2. Contacts
3. Leads
4. Solutions
5. Custom Objects
237. What is the difference between Role & Profile in salesforce.com?
Profile:
Profiles are set of permissions and setting which determines the objects, the fields of the object, tabs & apps the user can access. It also determines the page layout & record type accessible to the user. Profile is a required field while user creation.
Role:
Role control the level of visibility/access to organization’s data at the record level. Users at any given role can view, edit & report on data accessible to all the users below them in role hierarchy. Role is not a required field while user creation.
Example:
Let’s take an example of a software company Ajanya.com. It has two profiles Developer & Tester and two roles Trainee & Manager. Let’s consider that Defect is a custom object.
By using Profile we can ensure that Defect can by created only by user with Tester profile and User with Developer profile can only edit the defect description.
By using Roles we can ensure that the user with Profile Developer & Role Manager can view the Defects assigned to user with profile Developer & Role Trainee.
238. What are different portals in Salesforce.com?
Partner Portal:
A partner portal allows partner users to log in to Salesforce.com through a separate website than non-partner users. Partner users can only view & edit data that has been made available to them. An organization can have multiple partner portals.
For partner portal best practices please refer link:
https://ap1.salesforce.com/help/doc/en/partner_portal_best_practices.htm
Customer Portal:
Customer Portal provides an online support channel for customers allowing them to resolve their inquiries without contacting a customer service representative. An organization can have multiple customer portals.
239. What is the use of Salesforce.com Sites?
Force.com Sites enables you to create public websites and applications that are directly integrated with your Salesforce organization without requiring users to log in with a username and password. You can publicly expose any information stored in your organization through a branded URL of your choice. Sites are hosted on Force.com servers and built on native Visualforce pages. You can user authentication to a public site using customer portal.
240. How to import attachments using Data Loader in salesforce?
Please follow the instructions below.
1. Create an AttachmentList.csv file with the following column headers:
• ParentId - ID of the record to which the attachment should be associated
• Name - Name of the attachment
• ContentType - Format of the extension (e.g. .xls, .pdf, etc)
• OwnerID - ID for the owner of the attachment
• Body - File path to the Attachment on your local machine (C:\Attachments\FileName.pdf)
2. Log in to the Data Loader.
3. Select the "Insert" command.
4. In the 'Select Sforce Object' step, select the ‘Attachments’ object. This object is not displayed by default hence check the ‘Show all Sforce Objects' checkbox.
5. Choose the AttachmentList.csv file.
6. In the mapping step, map the following fields:
• Parent ID
• Name
• Owner ID
• Body - Make sure to map the Body column which you created previously with the file extension. This is how you designate the file and location of the attachments to be inserted.
7. Click "OK" to start the upload.
241. What are groups in SFDC and what is their use in salesforce?
Groups are set of users. They can contain individual users, other groups, the users in a particular role or territory, or the users in a particular role or territory plus all of the users below that role or territory in the hierarchy.
There are two types of groups:
• Public groups: Only administrators can create public groups. They can be used by everyone in the organization.
• Personal groups: Each user can create groups for their personal use.
You can use groups in the following ways:
• To set up default sharing access via a sharing rule
• To share your records with other users
• To specify that you want to synchronize contacts owned by others users
• To add multiple users to a Salesforce CRM Content library
• To assign users to specific actions in Salesforce Knowledge
242. What is the difference between public cloud & private cloud in salesforce? Is salesforce.com a public cloud or private cloud?
Public Cloud: Could services are provided "as a service" over the Internet with little or no control over the underlying technology infrastructure. More than one tenant can use the same resources.
Private Cloud: This also offers activities and functions "as a service" but is deployed over a company intranet or hosted datacenter. This is private product for a company or organization offering advance security.
Salesforce.com: Is a public cloud as it is hosted on salesforce.com data centers and data of more than one tenant resides on same servers.
243. What is the difference between custom controller and extension in salesforce?
Custom Controller: A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.
Controller extension: A controller extension is an Apex class that extends the functionality of a standard or custom controller. Use controller extensions when:
• You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete.
• You want to add new actions.
• You want to build a Visualforce page that respects user permissions. Although a controller extension class executes in system mode, if a controller extension extends a standard controller, the logic from the standard controller does not execute in system mode. Instead, it executes in user mode, in which permissions, field-level security, and sharing rules of the current user apply.
A controller extension is any Apex class containing a constructor that takes a single argument of type ApexPages.StandardController or CustomControllerName, whereCustomControllerName is the name of a custom controller you want to extend.
Note: Although custom controllers and controller extension classes execute in system mode and thereby ignore user permissions and field-level security, you can choose whether they respect a user's organization-wide defaults, role hierarchy, and sharing rules by using the with sharing keywords in the class definition.
244. What are different kinds of reports?
1. Tabular: Tabular reports are the simplest and fastest way to look at data. Similar to a spreadsheet, they consist simply of an ordered set of fields in columns, with each matching record listed in a row. Tabular reports are best for creating lists of records or a list with a single grand total. They can't be used to create groups of data or charts, and can't be used in dashboards unless rows are limited. Examples include contact mailing lists and activity reports.
2. Summary: Summary reports are similar to tabular reports, but also allow users to group rows of data, view subtotals, and create charts. They can be used as the source report for dashboard components. Use this type for a report to show subtotals based on the value of a particular field or when you want to create a hierarchical list, such as all opportunities for your team, subtotaled by Stage and Owner. Summary reports with no groupings show as tabular reports on the report run page.
3. Matrix: Matrix reports are similar to summary reports but allow you to group and summarize data by both rows and columns. They can be used as the source report for dashboard components. Use this type for comparing related totals, especially if you have large amounts of data to summarize and you need to compare values in several different fields, or you want to look at data by date and by product, person, or geography. Matrix reports without at least one row and one column grouping show as summary reports on the report run page.
4. Joined: Joined reports let you create multiple report blocks that provide different views of your data. Each block acts like a “sub-report,” with its own fields, columns, sorting, and filtering. A joined report can even contain data from different report types.
245. What are different kinds of dashboard component?
1. Chart: Use a chart when you want to show data graphically.
2. Gauge: Use a gauge when you have a single value that you want to show within a range of custom values.
3. Metric: Use a metric when you have one key value to display.
• Enter metric labels directly on components by clicking the empty text field next to the grand total.
• Metric components placed directly above and below each other in a dashboard column are displayed together as a single component.
4. Table: Use a table to show a set of report data in column form.
5. Visualforce Page: Use a Visualforce page when you want to create a custom component or show information not available in another component type
6. Custom S-Control: Custom S-Controls can contain any type of content that you can display or run in a browser, for example, a Java applet, an ActiveX control, an Excel file, or a custom HTML Web form\
246. Write a syntax and structure of scheduler class?
Sample class
global class ScheduleDemo implements Schedulable{
global void execute(SchedulableContext sc){
BatchClass b = new BatchClass();
database.executeBatch(b);
}
}
247. Write a apex code to send a email?
Sample code snippet to send an email using apex code
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[]{‘talk2srikrishna@gmail.com’};
mail.setToAddress(toAddresses);
mail.setSubject(‘Sample Mail Subject’);
mail.setPlainTextBody(‘Hello World!’);
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail});
248. What are the aggregate functions supported by salesforce SOQL?
Following aggregate functions are supported by salesforce SOQL
1. SUM()
2. MIN()
3. MAX()
4. COUNT()
5. AVG()
6. COUNT_DISTINCT()
249. Write a sample aggregate query or explain how to write a aggregate queries?
The return types of Aggregate functions are always an array of AggregateResult.
Sample Code
AggregateResult[] ar = [select AVG(Amount) aver from Opportunity];
Object avgAmt = ar[0].get(‘aver’);
250. Write a code to find the average Amount for all your opportunities by campaign?
AggregateResult[] arList = [select CampaignId, AVG(amount) from Opportunity group by CampaignId];
for(AggregateResult ar : arList){
System.debug(‘CampaignId ’ + ar.get(‘CampaignId’));
System.debug(‘Average Amount’ + ar.get(‘expr0’));
}
251. What are email services in salesforce and explain how we can use them in code?
Email services are automated processes that use apex class to process the contents, headers and attachment of an inbound email.
Sample code
Use Case: create a contact record if the inbound email subject is Create Contact and body contains contact name
global CreateContactFromEmail implements Messaging.InboundEmailHandler{
global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelop envelop){
Messaging.InboundEmailResult res = new Messaging.InboundEmailResult();
String strToCompare = ‘Create Contact’;
If(email.subject.equalsIgnoreCase(strToCompare)){
Contact c = new Contact();
c.LastName = email.plainTextBody();
insert c;
//save text attachments
for(Messaging.InboundEmail.TextAttachment att : email.textAttachments){
Attachment a = new Attachment();
a.Name = att.fileName;
a.Body = att.Blob.valueOf(att.Body);
a.ParentId = c.Id;
insert attachment;
}
//save binary attachments
for (Messaging.Inboundemail.BinaryAttachment bAttachment : email.binaryAttachments) {
Attachment attachment = new Attachment();
attachment.Name = bAttachment.fileName;
attachment.Body = bAttachment.body;
attachment.ParentId = c.Id;
insert attachment;
}
}
res.Success = true;
return res;
}
}
252. What is the relationship between Contact and Account objects in salesforce?
In Salesforce, Contacts is having a look up relationship with Accounts i.e., Simple relationship
253. What are different Organization Wide Defaults? Explain each of them?
Below are the different OWD values
Private
If the OWD for an object is set to private, then only the owner, and users above that role in role hierarchy, can view, edit and report on those records
Public Read Only
If the OWD for an object is set to Public Read Only, then all users can view and report on records but they cannot edit them. Only the record owner and the users above that role in the role hierarchy can edit the records
Public Read/Write
If the OWD for an object is set to Public Read/Write, then all users can view, edit and report on all records. But only owner of the record can delete the records.
Public Read/Write/Trfer
This is available only for Case and Lead objects
If the OWD for an object is set to Public Read/Write/Trfer then, all users can view, edit, trfer and report on all the records but only owner of the record can delete the records
Public Full Access
This is available only for Campaign object.
If the OWD for Campaigns are set Public Full Access then, all users can view, edit, delete and report on all records.
No Access, View Only or Use
This is available only for Price Book object.
If the OWD for Price Book is set Use then, all users can access the Price Book information and as well as using the Price Book configuration for Opportunities with Products.
If the OWD for Price Book is set View Only then, all users can access the Price Book information but not to use that Price Book detail in Opportunities with Products
If the OWD for Price Book is set No Access then, it restricts users from accessing information for Price Book and Prices.
Controlled By Parent
If the OWD for any object is set as Controlled By Parent, then user can perform an action on the record based on whether they can do the same on the parent record associated with it
254. Is it mandatory to select User License while creating permission sets? If not, what is the significance of selecting a User License?
It is not mandatory to select a User License while creating a permission sets.
If users with one type of license will use this permission set, then choose the same license that’s associate with them.
If you are planning to assign this permission set to multiple users with different licenses then, choose none.
255. Can we create a new profile without cloning an existing profiles?
No, we have to clone any one of the existing profiles to create a new profile
256. Please explain the use of Grant Access Using Hierarchies?
In Sharing settings, OWD settings, we have a check box Grant Access Using Hierarchies (for both standard and custom objects). If this check box is checked then it will give automatic access to the user’s data to other users in higher role of salesforce CRM Role Hierarchy.
If this check box is not checked then, only record owner and users granted access by OWD can gain the access.
257. What is the batch size limit (increment size for batch) in Data Loader?
Data Loader batch size limit is maximum of 200 per increment and if we selected Use Bulk API then maximum value is 10000
258. What is the difference between Export and Export All in the context of Data Loader?
Export enables user to export all the records for a particular object excluding the records in the recycle bin or soft deleted records.
Export All enables user to export all the records for a particular object including the records in the recycle bin or soft deleted records.
259. What are the post refresh considerations?
1. New Organization ID is assigned to the refreshed sandbox every time it is refreshed. Hence we need to replace the hard coded organization id in our sandbox post refresh with newly created organization id.
2. To ensure the uniqueness, in all user records, user name will be appended by sandbox name, if the resulting user name is not unique then, second round of modification is performed to prepend the user name with alpa numeric string to make sure the resulting username is unique.
3. The copy process does not copy contact data to developer and configuration sandboxes. Therefore, customer portal users are not copied. These customer portal users need to be created manually on need basis.
4. User email addresses are modified in sandbox to avoid sending any mail from sandbox such as notifications triggered by workflows and escalations rules.
5. Newly created sandboxes have the default email deliverability setting System email only. We need to change this to All Email.
6. If Server URL is hardcoded in the code, then we need to replace it with the newly created URL
260. What is the storage limit of Full Copy, Configuration Only and Developer sandboxes?
Full Copy Sandbox has the same storage limit as your production organization
Configuration Only sandbox has the storage limit of 500MB
Developer Sandbox has the storage limit of 10MB
261. What is the interval of refreshing of Full Copy, Configuration Only and Developer sandboxes?
Full Copy Sandbox can be refreshed once in 29 days
Configuration Sandbox can be refreshed once per day
Developer Sandbox can be refreshed once per day
262. What are the default sharing settings?
Default sharing settings are as follows
1. Controlled By Parent
2. Private
3. Public Read Only
4. Public ReadWrite
5. Public Read/Write/Trfer (Only for Case and Lead objects)
6. Public Full Access (Only for Campaign object)
7. Grant Access Using Hierarchies
263. How many roles we can create for an organization?
We can create up to 500 roles for an organization
264. How many permission sets we can create for an organization?
We can create up to 1000 permission sets for an organization
265. How many types of custom tabs are available in salesforce?
There are 3 types of custom tabs are available in salesforce
1. Custom Object Tabs
2. Visualforce Tabs
3. Web Tabs
Wrapper Class in Apex Salesforce:
Wrapper class is collections of different data type, subject etc.
In following example we are bind Account ,Opportunity standard object. We query and perform
business logic on the Collection of elements across unrelated objects with the custom data type.
Visual Force Page:
<apex:page controller="wrapperDemoCtrl">
<apex:pageBlock title="Account From wrapper Class">
<apex:pageBlockTable value="{!wraccount}" var="wra">
<apex:column value="{!wra.acc.Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="Opportunity From wrapper Class">
<apex:pageBlockTable value="{!wraoppn}" var="wropp">
<apex:column value="{!wropp.op.Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Controller :
public class wrapperDemoCtrl {
public list<wrapperClass> wraplist{get;set;}
public list<wrapperClass> getwraccount()
{
list<Account>acclist=[select Id,Name from Account limit 3];
wraplist= new list<wrapperClass>();
for(Account acn: acclist)
{
wraplist.add(new wrapperClass(acn));
}
return wraplist;
}
public list<wrapperClass> getwraoppn()
{
list<Opportunity>opplist=[select Id,Name from Opportunity limit 3];
wraplist= new list<wrapperClass>();
for(Opportunity opn:opplist )
{
wraplist.add(new wrapperClass(opn));
}
return wraplist;
}
public class wrapperClass{
public Account acc {get;set;}
public Opportunity op {get;set;}
public wrapperClass(Account accn){
acc= accn;
}
public wrapperClass(Opportunity opn)
{
op=opn;
}
}
}
Wrapper class is collections of different data type, subject etc.
In following example we are bind Account ,Opportunity standard object. We query and perform
business logic on the Collection of elements across unrelated objects with the custom data type.
Visual Force Page:
<apex:page controller="wrapperDemoCtrl">
<apex:pageBlock title="Account From wrapper Class">
<apex:pageBlockTable value="{!wraccount}" var="wra">
<apex:column value="{!wra.acc.Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:pageBlock title="Opportunity From wrapper Class">
<apex:pageBlockTable value="{!wraoppn}" var="wropp">
<apex:column value="{!wropp.op.Name}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
Controller :
public class wrapperDemoCtrl {
public list<wrapperClass> wraplist{get;set;}
public list<wrapperClass> getwraccount()
{
list<Account>acclist=[select Id,Name from Account limit 3];
wraplist= new list<wrapperClass>();
for(Account acn: acclist)
{
wraplist.add(new wrapperClass(acn));
}
return wraplist;
}
public list<wrapperClass> getwraoppn()
{
list<Opportunity>opplist=[select Id,Name from Opportunity limit 3];
wraplist= new list<wrapperClass>();
for(Opportunity opn:opplist )
{
wraplist.add(new wrapperClass(opn));
}
return wraplist;
}
public class wrapperClass{
public Account acc {get;set;}
public Opportunity op {get;set;}
public wrapperClass(Account accn){
acc= accn;
}
public wrapperClass(Opportunity opn)
{
op=opn;
}
}
}
266. What is apex scheduler?
Apex scheduler is used 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.
The Schedulable interface
contains one method that must be implemented, execute.
The implemented method must
be declared as global or public.
The following example
implements the Schedulable interface for a class
called mergeNumbers:
global void
execute(SchedulableContext SC) {
mergeNumbers M = new
mergeNumbers();
}
}
The following example uses
the System.Schedule method to implement the above class.
String sch = '20 30 8 10 2 ?';
system.schedule('Merge Job',
sch, m);
You can also use
the Schedulable interface with batch Apex classes. The
following example implements the Schedulable interface for a
batch Apex class called batchable:
global void
execute(SchedulableContext sc) {
batchable b = new batchable();
database.executebatch(b);
}
}
Use the SchedulableContext
object to keep track of the scheduled job once it's scheduled. The
SchedulableContext method getTriggerID returns the ID of the CronTrigger object associated with this scheduled job
as a string. Use this method to track the progress of the scheduled job.
To stop execution of a job
that was scheduled, use the System.abortJob method with the ID
returned by the.getTriggerID method.
267. Write a syntax and structure
of scheduler class?
Sample class
global class ScheduleDemo
implements Schedulable{
global
void execute(SchedulableContext sc){
BatchClass
b = new BatchClass();
database.executeBatch(b);
}
}
268. What is Scheduler class in Apex?
The Apex class which is programmed to run at
pre defined interval.
Class must
implement schedulable interface and it contains method named
execute().
There are two ways to invoke scheduler:
1.
Using UI
2.
Using System.schedule (Schedule method of
System class)
The classes which implements interface
schedulable get the button texted with “Schedule”, when user clicks on that
button; new interface opens to schedule the classes which implements that
interface.
To see what happened to scheduled job, go to
“Monitoring | Scheduled jobs “
Example of scheduling:
scheduledMerge m
= new scheduledMerge();
String sch = '20 30 8 10 2 ?';
system.schedule('Merge Job', sch, m);
Here:
20 represents seconds
30 represents minutes
8 represents hour of the day
10 represents 10th day of month
2 represents month of the year
? represents day of the month
269. Write a apex code to send a
email?
Sample code snippet to send
an email using apex code
Messaging.SingleEmailMessage
mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new
String[]{‘talk2srikrishna@gmail.com’};
mail.setToAddress(toAddresses);
mail.setSubject(‘Sample Mail
Subject’);
mail.setPlainTextBody(‘Hello
World!’);
Messaging.sendEmail(new
Messaging.SingleEmailMessage[]{mail});
270. What are the aggregate
functions supported by salesforce SOQL?
Following aggregate functions
are supported by salesforce SOQL
1.
SUM()
2.
MIN()
3.
MAX()
4.
COUNT()
5.
AVG()
6.
COUNT_DISTINCT()
271. Write a sample aggregate
query or explain how to write a aggregate queries?
The return types of Aggregate
functions are always an array of AggregateResult.
Sample Code
AggregateResult[] ar = [select
AVG(Amount) aver from Opportunity];
Object avgAmt =
ar[0].get(‘aver’);
272. Write a code to find the
average Amount for all your opportunities by campaign?
AggregateResult[] arList =
[select CampaignId, AVG(amount) from Opportunity group by CampaignId];
for(AggregateResult ar :
arList){
System.debug(‘CampaignId
’ + ar.get(‘CampaignId’));
System.debug(‘Average
Amount’ + ar.get(‘expr0’));
}
273. What are email services in
salesforce and explain how we can use them in code?
Email services are automated
processes that use apex class to process the contents, headers and attachment
of an inbound email.
Sample code
Use Case: create a contact
record if the inbound email subject is Create Contact and body contains contact
name
global CreateContactFromEmail
implements Messaging.InboundEmailHandler{
global
Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email,
Messaging.InboundEnvelop envelop){
Messaging.InboundEmailResult
res = new Messaging.InboundEmailResult();
String
strToCompare = ‘Create Contact’;
If(email.subject.equalsIgnoreCase(strToCompare)){
Contact
c = new Contact();
c.LastName
= email.plainTextBody();
insert
c;
//save
text attachments
for(Messaging.InboundEmail.TextAttachment
att : email.textAttachments){
Attachment a = new Attachment();
a.Name = att.fileName;
a.Body = att.Blob.valueOf(att.Body);
a.ParentId = c.Id;
insert attachment;
}
//save
binary attachments
for
(Messaging.Inboundemail.BinaryAttachment bAttachment : email.binaryAttachments)
{
Attachment attachment = new
Attachment();
attachment.Name = bAttachment.fileName;
attachment.Body = bAttachment.body;
attachment.ParentId = c.Id;
insert
attachment;
}
}
res.Success = true;
return res;
}
}
274. What is the row limit for
apex:dataTable and apex:pageBlockTable?
The data set for both
apex:dataTable and apex:pageBlockTable can have up to 1000 items.
275. What is the difference
between apex:pageMessages, apex:pageMessage, apex:Message and apex:Messages?
apex:PageMessages:
This component displays all messages that were
generated for all components on the current page, presented using the
salesforce styling. This will display both salesforce generated messages as
well as custom messages added to the ApexPages class
apex:PageMessage:
Apex:PageMessage is a component that adds single
message on the page. This is used to display custom message using the
salesforce formatting
apex:Message:
apex:Message is used to display an error on only
a specific field. It is used to allow developers to place field specific errors
in specific location.
apex:Messages:
apex:Messages is similar to apex:Message but it
displays all errors
276. How can we hard delete a
record using a Apex class/by code?
ALL ROWS key word can be used
to get all the records including records in the recycle bin.
Below is the sample code to
delete contact records from recycle bin
List<Contact> dContactList=[Select ID From
Contact Where IsDeleted = true limit 199 ALL ROWS];
Database.emptyRecycleBin( dContactList );
Database.emptyRecycleBin( dContactList );
278. Write a syntax and structure
of batch class?
Sample class
global Class BatchDemo
implements Database.Batchable<sObject>{
global Database.QueryLocator
start(Database.BatchableContext bc){
return
Database.getQueryLocator(query);
}
global void
execute(Database.BachableContext bc, List<sObjects> scope){
}
global void
finish(Database.BachableContext bc){
}
}
Below code will call the
batch class
BatchDemo bd = new BatchDemo();
database.executebatch(bd);
279. What is batch apex?
Batch Apex is exposed as an
interface that must be implemented by the developer. Batch jobs can be
programmatically invoked at runtime using Apex.
Need of Batch Apex: - As you
all might know about the salesforce governor limits on its data. When you want
to fetch thousands of records or fire DML on thousands of rows on objects it is
very complex in salesforce and it does not allow you to operate on more than
certain number of records which satisfies the Governor limits.
But for medium to large
enterprises, it is essential to manage thousands of records every day.
Adding/editing/deleting them when needed.
Salesforce has come up with a
powerful concept called Batch Apex. Batch Apex allows you to handle more number
of records and manipulate them by using a specific syntax.
We have to create a global
apex class which extends Database.Batchable Interface because of which the
salesforce compiler will know, this class incorporates batch jobs. Below is a
sample class which is designed to delete all the records of Account object
(Lets say your organization contains more than 50 thousand records and you want
to mass delete all of them).
Examples:-
global class deleteAccounts
implements Database.Batchable
{
global final String Query;
global deleteAccounts(String q)
{
Query=q;
}
global Database.QueryLocator
start(Database.BatchableContext BC)
{
return
Database.getQueryLocator(query);
}
global void
execute(Database.BatchableContext BC,List scope)
{
List <Account> lstAccount
= new list<Account>();
for(Sobject s : scope)
{
Account a = (Account)s;
lstAccount.add(a);
}
Delete lstAccount;
}
global void
finish(Database.BatchableContext BC)
{
//Send an email to the User after your batch completes
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[]
{‘sforce2009@gmail.com’};
mail.setToAddresses(toAddresses);
mail.setSubject('Apex Batch Job
is done‘);
mail.setPlainTextBody('The batch
Apex job processed ');
Messaging.sendEmail(new
Messaging.SingleEmailMessage[] { mail });
}
}
//This is how the batch class
is called.
id batchinstanceid =
database.executeBatch(new deleteAccounts(‘select Id from Account’));
280. What are web service
callouts?
Apex Code supports the
ability to expose Apex methods as a Web service. Apex also supports the ability
to invoke external web services and this will refer to as 'Callouts.' The
former is involved in creating a web service that a client can invoke, while
the latter is invoking an external web service.
281. What are wrapper classes?
A wrapper or container class
is a class, a data structure, or an abstract data type whose instances are
collections of other objects.
282. How do you hide header and
sidebar on visualforce page?
Below is the code to hide
sidebar and header
<apex:page
showHeader="false" sidebar="false">
</apex:page>
283. What is the difference between standard and custom
controller?
The standard controller is
auto generated by SF for all objects.
Custom controllers are
written by you and do what your code tells them to do.
284. How do you read parameter in
visualforce page?
Below syntax can be used to
read parameters in visualforce page
<apex:inputField
value="{!$CurrentPage.parameters.Paramtervalue}"/>
Additional code:
If you're writing a custom
controller, use the ApexPages global object variable
and currentPage() and getParameters() methods to get query
string parameters. For example, to get the value of the name query parameter in
the URL: https://na1.salesforce.com/001/e?name=value, use the following
line in your custom controller:
·If you're editing a page, use
the $PageContext global variable in a merge field.
For example, suppose you want
to add the Open Activities related list to an account detail page, but instead
of showing the account's activities, you want to show the activities of a
specified contact. To specify the contact, the following page looks for a query
string parameter for the contact's ID under the name relatedId:
<apex:pageBlock
title="Hello {!$User.FirstName}!">
You belong to the {!account.name}
account.<br/>
You're also a nice person.
</apex:pageBlock>
<apex:detail
subject="{!account}" relatedList="false"/>
<apex:relatedList
list="OpenActivities"
subject="{!$CurrentPage.parameters.relatedId}"/>
</apex:page>
For this related list to
render in a saved page, valid account and contact IDs must be specified in the
URL. For example, if 001D000000HRgU6 is the account ID
and 003D000000OXDIx is the contact ID, use the
URLhttps://na3.salesforce.com/apex/MyFirstPage?id=001D000000HRgU6&
relatedId=003D000000OXDIx.
To set a query string
parameter:
· If you're writing a custom controller, use
the setParameters() method with ApexPages.currentPage() to
add a query parameter in a test method. For example:
String value = 'Caroline';
ApexPages.currentPage().setParameters().put(key,
value);
Note
The setParameters() method
is only valid inside test methods.
· If you're editing a page, you can either
construct a URL manually:
Search Google
</apex:outputLink>
Or you can use
the <apex:param> tag as a child tag to write cleaner code:
Search Google
<apex:param
name="q" value="{!account.name}"/>
</apex:outputLink>
285. How can we pass javascript variable to apex class?
VF Page (Use assign input
variable to VF using $Component.FieldId)
<apex:page
controller="Js_Test_Class">
<apex:form>
<script>
function
setVal()
{
document.getElementById("{!$Component.hdnField}").value
= "TestValue";
}
</script>
<apex:inputHidden
id="hdnField" value="{!theValue}" />
<apex:commandButton
value="Post Page" action="{!post}" />
</apex:form>
<script>
setVal();
</script>
</apex:page>
Controller (Declare setter
and getter for the variable being used in VF page)
public class Js_Test_Class {
public
String theValue { get;set;}
public void post() {
System.Debug('The value is : ' +
theValue);
}
}
286. Is it possible to call apex
method in javascript code? If yes, explain?
Yes, we can call apex methods
using javascript. We can achieve this using ActionFunction. ActionFunction
allow you to tie an apex method to a javascript function name and invoke
synchronously. ActionFunction must be a child of apex:form component.
Example VF Page
<apex:page controller="t">
<script>
function myJavascriptFunc()
{
alert('Entered Javascript') ;
CallApexMethod() ;
}
</script>
<apex:form >
<apex:actionFunction
name="CallApexMethod" action="{!myActionInController}"
onComplete="alert('After apex method') ;"/>
<apex:pageBlock >
<apex:pageBlockButtons>
<apex:commandButton
value="Hit Me" onclick="myJavascriptFunc() ;"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Example Controller
public class t
public PageReference
myActionInController(){
return null ;
}
}
287. What is commandLink? Explain
the usage?
CommandLink is a link that
executes an action defined by a controller, and then refreshes the current page
or navigate to the different page based on the PageReference variable that is
returned by the action.
commandLink component must be
a child of an form component.
Example:
<apex:commandLink
action=”{!save}” value=”Save” id=”theCommandLink”/>
288. What is outputLink? Explain
the usage?
OutputLink is a link to URL.
This component is rendered in HTML as an anchor tag with an href attribute. The
body of the OutputLink is a text or image that displays as the link
Example:
<apex:outputLink
value=”http://www.google.com” id=”theLink”>www.google.com</outputLink>
289. How to get URL parameters in
Visuaforce page?
If the URL is something link
this
https://<salesforce
instance>/apex/getQueryStringParam?id=001d000000B1Gj5&cid=003d000000BIjFh
and if we want to read cid in
our visualforce page then,
Use:
$CurrentPage.parameters.cid
Or
If there is a single
parameter in the URL string link this
https://xxx.visual.force.com/apex/NewPage?TestValue=value1&retURL=a0HS000000450UD
Then Use:
$CurrentPage.parameters.Paramtervalue
290. How to set URL parameters in
Visuaforce page?
Setting a Query String
parameter can be achieved by two ways.
One:
Construct a URL manually
like,
<apex:outputLink
value="http://google.com/search?q={!account.name}">
Search Google
</apex:outputLink>
Two
<apex:outputLink
value="http://google.com/search">
Search Google
<apex:param
name="q" value="{!account.name}"/>
</apex:outputLink>
291. How to get URL parameters in
APEX class?
If the URL is something link
this
https://<salesforce
instance>/apex/getQueryStringParam?id=001d000000B1Gj5&cid=003d000000BIjFh
And if we want to read cid in
our visualforce page then,
Use:
String id =
ApexPages.currentPage().getParameters().get('id');
String id =
ApexPages.currentPage().getParameters().get('cid');
292. How to set URL parameters in
APEX class?
To set a URL parameter using
Apex code use below syntax
String key = 'name';
String value = 'Caroline';
ApexPages.currentPage().getParameters().put(key,
value);
Or
ApexPages.currentPage().getParameters().set(‘value’);
293. Explain how MVC architecture
fit for Salesforce?
In salesforce, Apex Classes
works as Controllers, Visualforce Pages works as View and Custom objects works
as Model.
294. How to use actionFunction,
actionSupport and actionPollar in salesforce?
actionFunction : provides
support for invoking controller action methods directly from JavaScript code
using an AJAXrequest
Used when we need to perform
similar action on various events. Even though, you can use it in place of
actionSupport as well where only event is related to only one control.
Example:
actionFunction: provides
support for invoking controller action methods directly from JavaScript code
using an AJAXrequest
Example :
<!-- Page: -->
<apex:page
controller="exampleCon">
<apex:form>
<!-- Define the JavaScript
function sayHello-->
<apex:actionFunction
name="sayHello" action="{!sayHello}"
rerender="out"
status="myStatus"/>
</apex:form>
<apex:outputPanel
id="out">
<apex:outputText
value="Hello "/>
<apex:actionStatus
startText="requesting..." id="myStatus">
<apex:facet
name="stop">{!username}</apex:facet>
</apex:actionStatus>
</apex:outputPanel>
<!-- Call the sayHello
JavaScript function using a script element-->
<script>window.setTimeout(sayHello,2000)</script>
<p><apex:outputText
value="Clicked? {!state}" id="showstate" /></p>
<!-- Add the onclick event
listener to a panel. When clicked, the panel triggers
the methodOneInJavascript
actionFunction with a param -->
<apex:outputPanel
onclick="methodOneInJavascript('Yes!')"
styleClass="btn">
Click Me
</apex:outputPanel>
<apex:form>
<apex:actionFunction action="{!methodOne}"
name="methodOneInJavascript"
rerender="showstate">
<apex:param
name="firstParam" assignTo="{!state}" value=""
/>
</apex:actionFunction>
</apex:form>
</apex:page>
/*** Controller ***/
public class exampleCon {
String uname;
public String getUsername() {
return uname;
}
public PageReference sayHello()
{
uname = UserInfo.getName();
return null;
}
public void setState(String n) {
state = n;
}
public String getState() {
return state;
}
public PageReference methodOne()
{
return null;
}
private String state = 'no';
}
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.
Used when we want to perform
an action on a particular event of any control like onchange of any text box or
picklist.
Example:
<!-- Page: -->
<apex:page
controller="exampleCon">
<apex:form>
<apex:outputpanel
id="counter">
<apex:outputText
value="Click Me!: {!count}"/>
<apex:actionSupport
event="onclick"
action="{!incrementCounter}"
rerender="counter"
status="counterStatus"/>
</apex:outputpanel>
<apex:actionStatus
id="counterStatus"
startText="
(incrementing...)"
stopText="
(done)"/>
</apex:form>
</apex:page>
/*** Controller: ***/
public class exampleCon {
Integer count = 0;
public PageReference
incrementCounter() {
count++;
return null;
}
public Integer getCount() {
return count;
}
}
ActionPolor: A
timer that sends an AJAX update request to the server according to a time
interval that you specify. The update request can then result in a full or
partial page update. You should avoid using this component with enhanced lists.
Used when we want to perform
an action on server again and again for a particular time interval.
Example:
<!-- Page -->
<apex:page
controller="exampleCon">
<apex:form>
<apex:outputText
value="Watch this counter: {!count}" id="counter"/>
<apex:actionPoller
action="{!incrementCounter}" rerender="counter"
interval="15"/>
</apex:form>
</apex:page>
/*** Controller: ***/
public class exampleCon {
Integer count = 0;
public PageReference
incrementCounter() {
count++;
return null;
}
295. What is the difference
between actionFunction and actionSupport tags?
Sl No |
ActionSupport
|
ActionFunction
|
1)
|
Directly call action method
without javascript
|
Call action method from
javascript with AJAX
|
2)
|
It can be used to call
action method on single event
|
It can be used to call
action method on different event
|
3)
|
It cannot be called from
javascript function. It only invoke controller action methods from other
Visualforce components
|
It defines a new JavaScript
function which can then be called from within a block of JavaScript code.
|
296. How do you do File Upload
using visualforce?
Below is the code sample of
file upload in visualforce
<!-- Page: -->
<apex:page
standardController="Document" extensions="documentExt">
<apex:messages />
<apex:form
id="theForm">
<apex:pageBlock>
<apex:pageBlockSection>
<apex:inputFile
value="{!document.body}" filename="{!document.name}"/>
<apex:commandButton
value="Save" action="{!save}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
/*** Controller ***/
public class documentExt {
public
documentExt(ApexPages.StandardController controller) {
Document d = (Document)
controller.getRecord();
d.folderid = UserInfo.getUserId();
//this puts it in My Personal Documents
}
}
298. Explain Apex Data Types
Apex primitive data types include
• String
• Blob (for storing binary data)
• Boolean
• Date, DateTime and Time
• Integer, Long, Decimal, Double
• ID (Force.com database record identifier)
• String
• Blob (for storing binary data)
• Boolean
• Date, DateTime and Time
• Integer, Long, Decimal, Double
• ID (Force.com database record identifier)
Example:
• DateTime dt = System.now() + 1;
• Boolean isClosed = true;
• String sCapsFirstName = ‘Andrew’.toUpperCase();
• DateTime dt = System.now() + 1;
• Boolean isClosed = true;
• String sCapsFirstName = ‘Andrew’.toUpperCase();
Apex sObject Types
Sobject (object representing a Force.com standard or custom object)
Sobject (object representing a Force.com standard or custom object)
Example:
• Account acct = new Account(); //Sobject example
• Account acct = new Account(); //Sobject example
Apex has the following types of collections
• Lists
• Maps
• Sets
• Lists
• Maps
• Sets
Example:
• List myList = new List();
• myList.add(12); //Add the number 12 to the list
• myList.get(0); //Access to first integer stored in the List
• List myList = new List();
• myList.add(12); //Add the number 12 to the list
• myList.get(0); //Access to first integer stored in the List
Enums
• Enum (or enumerated list) is an abstract that stores one value of a finite set of specified identifiers.
• To define an Enum, use enum keyword in the variable declaration and then define the list of values.
• By creating this Enum, you have created a new data type called Season that can be used as any other data type.
• Enum (or enumerated list) is an abstract that stores one value of a finite set of specified identifiers.
• To define an Enum, use enum keyword in the variable declaration and then define the list of values.
• By creating this Enum, you have created a new data type called Season that can be used as any other data type.
Example:
• public enum Season {WINTER, SPRING, SUMMER, FALL}
• public enum Season {WINTER, SPRING, SUMMER, FALL}
299. Explain Apex Variables?
Local variables are declared with Java-style
syntax.
For example:
• Integer i = 0;
• String str;
• Account a;
• Account[] accts;
• Set s;
• Map<ID, Account> m;
For example:
• Integer i = 0;
• String str;
• Account a;
• Account[] accts;
• Set s;
• Map<ID, Account> m;
300. Explain Static Methods and Variables?
• Class methods and variables can be declared
as static. Without this keyword, the default is to create instance methods and
variables.
• Static methods are accessed through the class itself, not through an object of the class:
• Static methods are accessed through the class itself, not through an object of the class:
Example:
public class blogReaders {
public static boolean firstScript = false;
}
• Static methods are generally utility methods that do not depend on an instance. System methods are static.
• Use static variables to store data that is shared with in the class.
• All instances of the same class share a single copy of static variables.
• This can be a technique used for setting flags to prevent recursive
public class blogReaders {
public static boolean firstScript = false;
}
• Static methods are generally utility methods that do not depend on an instance. System methods are static.
• Use static variables to store data that is shared with in the class.
• All instances of the same class share a single copy of static variables.
• This can be a technique used for setting flags to prevent recursive
301. What is the use of static variable?
When you declare a method or variable as
static, it’s initialized only once when a class is loaded. Static variables
aren’t trmitted 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.
Static variables are only static within the scope of the request. They are not static across the server, or across the entire organization.
302. Explain Final variables?
• The final keyword can only used with
variables.
• Classes and methods are final by default.
• Final variables can only be assigned a value once.
• When defining constants, both static and final keywords should be used.
• Classes and methods are final by default.
• Final variables can only be assigned a value once.
• When defining constants, both static and final keywords should be used.
Example: public static final Integer =47;
303. Difference between with sharing and without
sharing in salesforce
By default, all Apex executes under the System
user, ignoring all CRUD, field-level, and row-level security (that is always
executes using the full permissions of the current user).
without sharing:
Enforcing the User’s Permissions, Sharing rules and field-level security should apply to the current user.
For example:
public with sharing class sharingClass {
// Code here
}
Enforcing the User’s Permissions, Sharing rules and field-level security should apply to the current user.
For example:
public with sharing class sharingClass {
// Code here
}
without sharing:
Not enforced the User’s Permissions, Sharing rules and field-level security.
For example:
public without sharing class noSharing {
// Code here
}
Not enforced the User’s Permissions, Sharing rules and field-level security.
For example:
public without sharing class noSharing {
// Code here
}
Enforcing the current user’s sharing rules can
impact: (with sharing)
SOQL and SOSL queries – A query may return fewer rows than it would operating in system context.
DML operations – An operation may fail because the current user doesn’t have the correct permissions. For example, if the user specifies a foreign key value that exists in the organization, but which the current user does not have access to.
SOQL and SOSL queries – A query may return fewer rows than it would operating in system context.
DML operations – An operation may fail because the current user doesn’t have the correct permissions. For example, if the user specifies a foreign key value that exists in the organization, but which the current user does not have access to.
304. Explain Class Constructors with example?
• A constructor is a special method used to create (or
instantiate) an object out of a class definition.
• Constructors never have explicit return types.
• Constructors have the same name as the class.
• Classes have default, no-argument, public constructor if no explicit constructors is defined.
• If you create a constructor that takes arguments and still want a no-argument constructor, you must explicitly define one.
• Constructors can be overloaded, meaning you can have multiple constructors with different parameters, unique argument lists, or signatures.
• Constructors are called before all other methods in the class.
• Constructors never have explicit return types.
• Constructors have the same name as the class.
• Classes have default, no-argument, public constructor if no explicit constructors is defined.
• If you create a constructor that takes arguments and still want a no-argument constructor, you must explicitly define one.
• Constructors can be overloaded, meaning you can have multiple constructors with different parameters, unique argument lists, or signatures.
• Constructors are called before all other methods in the class.
For Example:
public class TestObject2 {
private static final Integer DEFAULT_SIZE = 10;
Integer size;
//Constructor with no arguments
public TestObject2() {
this(DEFAULT_SIZE); // Using this(…) calls the one argument constructor
}
// Constructor with one argument
public TestObject2(Integer ObjectSize) {
size = ObjectSize;
}
}
New objects of this type can be instantiated with the following code:
TestObject2 myObject1 = new TestObject2(42);
TestObject2 myObject2 = new TestObject2();
public class TestObject2 {
private static final Integer DEFAULT_SIZE = 10;
Integer size;
//Constructor with no arguments
public TestObject2() {
this(DEFAULT_SIZE); // Using this(…) calls the one argument constructor
}
// Constructor with one argument
public TestObject2(Integer ObjectSize) {
size = ObjectSize;
}
}
New objects of this type can be instantiated with the following code:
TestObject2 myObject1 = new TestObject2(42);
TestObject2 myObject2 = new TestObject2();
305. Class Access Modifiers
• Classes have different access levels
depending on the keywords used in the class definition.
global: this class is accessible by all Apex
everywhere.
• All methods/variables with the webService keyword must be global.
• All methods/variables dealing with email services must be global.
• All methods/variables/inner classes that are global must be within a global class to be accessible.
• All methods/variables with the webService keyword must be global.
• All methods/variables dealing with email services must be global.
• All methods/variables/inner classes that are global must be within a global class to be accessible.
public: this class is visible across you
application or name space.
private: this class is an inner class and is
only accessible to the outer class, or is a test class.
protected: this me that the method or variable
is visible to any inner classes in the defining Apex class. You can only use
this access modifier for instance methods and member variables.
To use the private, protected, public, or
global access modifiers, use the following syntax:
[(none)|private|protected|public|global] declaration
[(none)|private|protected|public|global] declaration
306. Explain Variable and Method Access Modifiers
in Apex?
• Methods and variables have different levels
depending on the keywords used in the declaration.
– private: This method/variable is accessible within the class it is defined.
– protected: This method/variable is also available to any inner classes or subclasses. It can only be used by instance methods and member variables.
– public: This method/variable can be used by any Apex in this application namespace.
– global: this method/variable is accessible by all Apex everywhere.
• All methods/variable with the webService keyword must be global.
– The default access modifier for methods and variables is private.
– private: This method/variable is accessible within the class it is defined.
– protected: This method/variable is also available to any inner classes or subclasses. It can only be used by instance methods and member variables.
– public: This method/variable can be used by any Apex in this application namespace.
– global: this method/variable is accessible by all Apex everywhere.
• All methods/variable with the webService keyword must be global.
– The default access modifier for methods and variables is private.
307. Explain Casting in Apex?
Apex
enables casting: A data type of one class can be assigned to a data type of
another class, but only if one class is a child of other class.
• Casting converts an object from one data type to another.
• Casting between the generic sObject type and the specific
sObject type is also allowed.
For Example:
sObject s = new Account();
Account a = (Account)s;
Contact c = (Contact)s //this generates a run time error.
• Casting converts an object from one data type to another.
• Casting between the generic sObject type and the specific
sObject type is also allowed.
For Example:
sObject s = new Account();
Account a = (Account)s;
Contact c = (Contact)s //this generates a run time error.
308. Explain Exceptions Statements in Apex?
Similar to Java, Apex uses exception to note
errors and other events that disrupt script execution with the following
Exception statement keywords:
• Throw: signals that an error has occurred and provides an exception object.
• Try: identifies the block of code where the exception can occur.
• Catch: identifies the block of code that can handle a particular exception. There may be multiple catch blocks for each try block.
• Finally: optionally identifies a block of code that is guaranteed to execute after a try block.
• Throw: signals that an error has occurred and provides an exception object.
• Try: identifies the block of code where the exception can occur.
• Catch: identifies the block of code that can handle a particular exception. There may be multiple catch blocks for each try block.
• Finally: optionally identifies a block of code that is guaranteed to execute after a try block.
Exception Example:
public class OtherException extends BaseException {}
Try{
//Add code here
throw new OtherException(‘Something went wrong here…’);
} Catch (OtherException oex) {
//Caught a custom exception type here
} Catch (Exception ex){
//Caught all other exceptions here
}
public class OtherException extends BaseException {}
Try{
//Add code here
throw new OtherException(‘Something went wrong here…’);
} Catch (OtherException oex) {
//Caught a custom exception type here
} Catch (Exception ex){
//Caught all other exceptions here
}
309. Name different Exceptions?
All exceptions support built-in methods for
returning the error message and exception type, below is the some of the
Exception Methods,
AsyncException
CalloutException
DmlException
EmailException
JSONException
ListException
MathException
NoAccessException
NoDataFoundException
NullPointerException
QueryException
AsyncException
CalloutException
DmlException
EmailException
JSONException
ListException
MathException
NoAccessException
NoDataFoundException
NullPointerException
QueryException
310. Explain about Salesforce annotations
Apex annotations modify the way a method or
class is used.
Below is the list of annotations supported by
salesforce
@Deprecated
Use
the deprecated annotation to identify methods, classes, exceptions,
enums, interfaces, or variables that can no longer be referenced in subsequent
releases of the managed package in which they
reside. This is useful when you are re-factoring code in managed packages as
the requirements evolve. New subscribers cannot see the deprecated elements,
while the elements continue to function for existing subscribers
and API integrations.
@Future
Use
the future annotation to identify methods that are executed asynchronously.
When you specify future, the method executes when Salesforce has
available resources.
To
test methods defined with the future annotation, call the class
containing the method in a startTest, stopTest code
block. All asynchronous calls made after the startTest method
are collected by the system. When stopTest is executed, all
asynchronous processes are run synchronously.
@IsTest
Use
the isTest annotation to define classes or individual methods that
only contain code used for testing your application.
The isTest annotation is similar to creating methods declared
as testMethod.
@ReadOnly
The @ReadOnly annotation
allows you to perform unrestricted queries against the Force.com database.
All other limits still apply. It's important to note that this annotation,
while removing the limit of the number of returned rows for a request, blocks
you from performing the following operations within the request: DML
operations, calls to System.schedule, calls to methods annotated
with @future, and sending emails.
@RemoteAction
The RemoteAction annotation
provides support for Apex methods used in Visualforce to be
called via JavaScript. This process is often referred to as JavaScript
remoting.
@TestVisible
Use the TestVisible annotation to allow test methods
to access private or protected members of another class outside the test class.
These members include methods, member variables, and inner classes. This
annotation enables a more permissive access level for running tests only.
Apex REST annotations:
@RestResource(urlMapping='/yourUrl')
The @RestResource annotation
is used at the class level and enables you to expose an Apex class as
a REST resource.
@HttpDelete
The @HttpDelete annotation
is used at the method level and enables you to expose an Apex method
as a REST resource. This method is called when an HTTP DELETE request
is sent, and deletes the specified resource.
@HttpGet
The @HttpGet annotation
is used at the method level and enables you to expose an Apex method
as a REST resource. This method is called when an HTTP GET request is
sent, and returns the specified resource.
@HttpPatch
The @HttpPatch annotation
is used at the method level and enables you to expose an Apex method
as a REST resource. This method is called when an HTTP PATCH request
is sent, and updates the specified resource.
@HttpPost
The @HttpPost annotation
is used at the method level and enables you to expose an Apex method
as a REST resource. This method is called when an HTTP POST request
is sent, and creates a new resource.
@HttpPut
The
@HttpPut annotation is used at the method level and enables you to expose an
Apex method as a REST resource. This method is called when an HTTP PUT request
is sent, and creates or updates the specified resource.
311. Difference between trigger.newMap and
trigger.oldMap?
Trigger.newMap - A map of IDs to the new versions of the sObject
records. Note that this map is only available in before update, after insert,
and after update triggers.
Trigger.oldMap - A map of IDs to the old
versions of the sObject records. Note that this map is only available in update
and delete triggers.
312. What are the available Trigger Events?
There are 6 trigger events available.
1. Insert
2. Update
3. Delete
4. Merge
5. Upsert
6. Undelete
313. What are the available Trigger contest
variables?
Below are the list of Trigger context variables
1. isBefore
2. IsAfter
3. isInsert
4. IsUpdate
5. isDelete
6. isUndelete
7. isExecuting
8. new
9. old
10. newMap
11. oldMap
12. size
314. What is Force.com IDE?
The Force.com IDE is a powerful client
application for creating, modifying, testing and deploying Force.com
applications. Based on the Eclipse platform, it 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.
315. Explain the Sequence of Salesforce Triggers
and Order of Execution?
The following is the
order of salesforce execution when the you create or update a record,
1) Loads the original record from the database or initializes the record for an upsert statement.
2) Loads the new record field values from the request and overwrites the old values.
If the request came from a standard UI edit page, Salesforce runs system validation to check the record for:
Required values at the layout level and field-definition level
Valid field formats (ex: zip code, country code format)
Maximum field length (ex: mobile number must 10 digits)
Salesforce doesn’t perform system validation in this step when the request comes from other sources, such as an Apex application or a SOAP API call.
3) Run all before triggers.
4) Runs most system validation steps again, such as verifying that all required fields have a non-null value, and runs any user-defined validation rules. The only system validation that Salesforce doesn’t run a second time (when the request comes from a standard UI edit page) is the enforcement of layout-specific rules.
5) Saves the record to the database, but doesn’t commit yet.
6) Run all after triggers.
7) Run assignment rules.
8) Run auto-response rules.
9) Run workflow rules.
10) If there are workflow field updates, updates the record again.
11) If the record was updated with workflow field updates, fires before and after triggers one more time (and only one more time), in addition to standard validations. Custom validation rules are not run again.
12) Run escalation rules.
13) If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure.
14) If the parent record is updated, and a grand-parent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Grand-parent record goes through save procedure.
15) Run Criteria Based Sharing evaluation.
16) Commits all DML operations to the database.
17) Run post-commit logic, such as sending email.
1) Loads the original record from the database or initializes the record for an upsert statement.
2) Loads the new record field values from the request and overwrites the old values.
If the request came from a standard UI edit page, Salesforce runs system validation to check the record for:
Required values at the layout level and field-definition level
Valid field formats (ex: zip code, country code format)
Maximum field length (ex: mobile number must 10 digits)
Salesforce doesn’t perform system validation in this step when the request comes from other sources, such as an Apex application or a SOAP API call.
3) Run all before triggers.
4) Runs most system validation steps again, such as verifying that all required fields have a non-null value, and runs any user-defined validation rules. The only system validation that Salesforce doesn’t run a second time (when the request comes from a standard UI edit page) is the enforcement of layout-specific rules.
5) Saves the record to the database, but doesn’t commit yet.
6) Run all after triggers.
7) Run assignment rules.
8) Run auto-response rules.
9) Run workflow rules.
10) If there are workflow field updates, updates the record again.
11) If the record was updated with workflow field updates, fires before and after triggers one more time (and only one more time), in addition to standard validations. Custom validation rules are not run again.
12) Run escalation rules.
13) If the record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Parent record goes through save procedure.
14) If the parent record is updated, and a grand-parent record contains a roll-up summary field or is part of a cross-object workflow, performs calculations and updates the roll-up summary field in the parent record. Grand-parent record goes through save procedure.
15) Run Criteria Based Sharing evaluation.
16) Commits all DML operations to the database.
17) Run post-commit logic, such as sending email.
316. What is Visualforce in Salesforce?
Visualforce is the component-based user
interface framework for the Force.com platform. The framework includes a
tag-based markup language, similar to HTML. Each Visualforce tag corresponds to
a coarse or fine-grained user interface component, such as a section of a page,
or a field. Visualforce boasts about 100 built-in components, and a mechanism
whereby developers can create their own components.
• Visualforce pages can react differently to different client browsers such as those on a mobile or touch screen device.
• Everything runs on the server, so no additional client-side callbacks are needed to render a complete view.
• Optional server-side call outs can be made to any Web service.
• Visualforce pages can react differently to different client browsers such as those on a mobile or touch screen device.
• Everything runs on the server, so no additional client-side callbacks are needed to render a complete view.
• Optional server-side call outs can be made to any Web service.
Visualforce is a Web-based framework that
lets you quickly develop sophisticated, custom UIs for Force.com desktop and
mobile apps. Using native Visualforce markup and standard Web development
technologies such as HTML5, CSS, JavaScript, and jQuery, you can rapidly build
rich UIs for any app.
317. Let’s say we have to update the same record
in After Trigger context. Is there any way or workaround?
If we create a new instance of a sObject in
the Apex Trigger in memory using the Id of the newly created record as provided
in the After Trigger context, we can perform an Update DML statement and not
get a read only error. This is because in Apex, the SObject is seen as a new
reference (even though the records have the same SFDC ID) and therefore is
eligible for DML operations. The below snippet of code illustrated this working
and not working.
List<Contact> originals
= new List<Contact>();
if(mirrorResultMap.values().size() > 0)
{
for(Contact origContact :
contactRecs.values())
{
Contact
mirrorContact = mirrorResultMap.get(origContact.Id);
//origContact.Linked_Contact__c
= mirrorContact.Id; //Link the Original Record tot he Mirror Record WILL FAIL
Contact
origContactUpdate = new Contact(Id=origContact.Id, Linked_Contact__c
= mirrorContact.Id); //This will WORK
originals.add(origContactUpdate);
}
//update
contactRecs.values(); //Update the Records -> THIS WILL FAIL AS ITS ORIGINAL
RECORDS IN MEMORY
update originals;
}
318. System.debug() statements are included
against script count?
Any statement ending with semi-colon will be
included against script count.
319. While trying to access javascript code from some CDN like Google, we get error something like “attempt to run uG request”. How to resolve it?
While providing URL, do not specify the
protocol.
Use like this:
<script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'></script>
320. Explain ActionFunction, ActionSupport and
ActionPoller in Visualforce.
apex:ActionFunction : This component
helps to invoke AJAX request (Call Controllers method) directly from Javascript
method. It must be child of apex:form.
apex:ActionSupport : This component adds
Ajax request to any other Visualforce component.
Example: Commandlink button has inbuilt AJAX
functionality however few components like OutputPanel does not have inbuilt
AJAX capabilities. So with the help of this component, we can enable AJAX.
apex:ActionPoller : This is timer
component which can send AJAX request on pre-defined interval. Minimum interval
is 5 sec and default is 60 sec.
321. In how many ways you can invoke Controllers /
Controller Extensions method from VF?
We can invoke Aprex Controllers or Controller
Extensions using below methods.
·
Javascript Remoting
·
ActionFunction
·
ActionSupport
·
ActionPoller
322. What is the use of apex:detail component ?
With the help of this Visualforce component,
we can directly get complete behavior of page layout defined for logged in
user’s profile. There is no need to add fields, related lists explicitly.
323. What is the difference between
“apex:dataTable” and “apex:pageBlockTable” components in Visualforce?
Both components are used to render data in tabular format.
DataTable
|
PageBlockTable
|
Not required
|
Should be defined inside pageBlock or
pageBlockSection
|
No styles are used
|
Uses standard style sheets
|
Not Required
|
It has the required attribute “value”
|
We need to specify
column headers explicitly
|
Column headers will be displayed
automatically
|
dataTable will render records in simple HTML
table format whereas the
pageBlockTable possess default look and feel
of salesforce standard CSS and must be written inside “apex:pageBlock”
component and a required argument value need to be passed for pageBlockTable.
324. User have all the permissions to see the
Dashboard and Source Folder still when he wants to see dashboard, it’s not
visible. What might be the cause?
It is possible that Salesforce User license
for Dashboard running user is different than User wants to access Dashboard.
Example – Running User license is “Salesforce”
and user trying to access Dashboard is “Salesforce Platform”.
325. How to implement the pagination in SOQL?
In spring 12, Salesforce has come up with
ability of SOQL to get records from position “X” instead of position “1” every
time to help creating pagination feature.
Pagination in SOQL using keyword Offset
Select Id, Name from Lead
LIMIT 5 OFFSET 2
Above query will return 5 Lead records
starting from record number 10 (5×2).
326. How to generate the random string or random
password using Apex?
Integer len = 10;
Blob blobKey = crypto.generateAesKey(128);
String key = EncodingUtil.convertToHex(blobKey);
String pwd = key.substring(0,len);
327. What is dynamic binding in salesforce?
Dynamic Visualforce bindings are a way of
writing generic Visualforce pages that display information about records
without necessarily knowing which fields to show. In other words, fields on the
page are determined at run time, rather than compile time. This allows a
developer to design a single page that renders differently for various
audiences, based on their permissions or preferences. Dynamic bindings are
useful for Visualforce pages included in managed packages since they allow for
the presentation of data specific to each subscriber with very little coding.
Example 1:
Access the Account name from Contact.
Access the Account name from Contact.
{!myContact['Account'][fieldname]}
Consider Data type in Apex
public Map<String,
List<Account>> accountsMap {get; set;}
Visualforce page:
<apex:variable value="A" var="selectedKey" />
<apex:pageBlockTable value="{!accountsMap[selectedKey]}" var="acc">
<apex:column value="{!acc.name}"/>
<apex:column value="{!acc.BillingStreet}"/>
<apex:column value="{!acc.BillingCity}"/>
<apex:column value="{!acc.BillingPostalCode}"/>
</apex:pageBlockTable>
328. How to convert lead using Apex?
Lead myLead = new Lead(LastName
= 'Foo', Company='Foo Bar');
insert myLead;
Database.LeadConvert lc
= new database.LeadConvert();
lc.setLeadId(myLead.id);
LeadStatus convertStatus = [SELECT Id,
MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
lc.setConvertedStatus(convertStatus.MasterLabel);
Database.LeadConvertResult lcr =
Database.convertLead(lc);
System.assert(lcr.isSuccess());
329. Consider total 90k records present in
Salesforce and you have used the count() method of soql. What will be output of
it? (we need to verify this feature in recent versions of the salesforce api’s)
It will throw an error something like “Too
many query rows: 50001”, as the record limit in SOQL is 50,000.
Although the count() returns only one row however it processes each record and thus hit the allowed governor limit.
Although the count() returns only one row however it processes each record and thus hit the allowed governor limit.
330. How to get the Recordtype Id using Dynamic
Apex?
Normally to get the RecordtypeId for any
sObject we use SOQL and it will count against your limit. So below method will
bypass the need of SOQL Query.
Map<String, Schema.SObjectType> m =
Schema.getGlobalDescribe() ;
Schema.SObjectType s =
m.get('API_Name_Of_SObject') ;
Schema.DescribeSObjectResult cfrSchema =
s.getDescribe() ;
Map<String,Schema.RecordTypeInfo>
RecordTypeInfo = cfrSchema.getRecordTypeInfosByName();
Id rtId = RecordTypeInfo.get('Record Type
Name').getRecordTypeId();
331. Write Apex code which will take the RecordID
as input and on the basis of that it will print the Object name and field names
of sObject.
List<Schema.SObjectType> gd =
Schema.getGlobalDescribe().Values();
Map<String,String> objectMap
= new Map<String,String>();
for(Schema.SObjectType f : gd)
{
objectMap.put(f.getDescribe().getKeyPrefix(),
f.getDescribe().getName());
}
String sampleId ='00390000003LIVw';
String prefix = sampleId.substring(0,3);
String objectName = objectMap.get(prefix);
System.debug('** SObject Name ** '+objectName);
System.debug('** SObject Name ** '+objectName);
Map<String, Schema.SObjectField> desResult
= Schema.getGlobalDescribe().get(objectName).getDescribe().Fields.getMap();
List<String> fieldList
= new List<String>();
fieldList.addAll(desResult.keySet());
for(integer i =0;i<fieldList.size();i++)
{
System.debug('** Field
Name ** '+fieldList[i]);
}
332. How to
get “https” link instead of “http” for Visualforce page using URLFOR() in Email
Template
When you create the Link using URLFOR() in
Email Template, it creates link in “http” format instead of “https” and thus
causes end user to logged into salesforce again.
So instead of
<a href='{!URLFOR('/apex/SomePage', null,
[id=Some_Object__c.Id,retURL="/apex/SomeOtherPage"])}'>Go to
SomePage here!</a>
We can use something like :
<a href='{!SUBSTITUTE(URLFOR('/apex/SomePage',
null,
[id=Some_Object__c.Id,retURL="/apex/SomeOtherPage"]),'http:','https:')}'>Go
to SomePage here!</a>
333. When you get the error “Non-selective query
against large object type”? How to resolve it?
Whenever an object has greater than 100K
records any query on that object must be “selective”. For a query to be
selective it must have enough indexed filters (where clauses) so that less than
10% of the records (in our example 10K) are returned before applying the limit
statement.
334. In Controller extension, you are getting the
error “SObject row was retrieved via SOQL without querying the requested field”
while accessing the field of parent Custom Object or standard Object for which
the Controller extension was written. How to resolve that?
In Constructor of the Controller extension,
only Id of Custom Object is supplied. We need to query the required field
explicitly in order to use in remaining part of the code.
335. Using Apex how you can determine that user is
in Sandbox or production?
By using below code, we can identify the given
organization is a sandbox or production.
If the code returns true then it is a sandbox
else it is a production.
public Static Boolean isSandbox(){
String host = URL.getSalesforceBaseUrl().getHost();
String server = host.substring(0,host.indexOf('.'));
//
It's easiest to check for 'my domain' sandboxes first
//
even though that will be rare
if(server.contains('--'))
return true;
//
tapp0 is a unique "non-cs" server so we check it now
if(server == 'tapp0')
return true;
//
If server is 'cs' followed by a number it's a sandbox
if(server.length()>2){
if(server.substring(0,2)=='cs'){
try{
Integer.valueOf(server.substring(2,server.length()));
}
catch(exception e){
//started with cs, but not
followed by a number
return false;
}
//cs followed by a number, that's a hit
return true;
}
}
//
If we made it here it's a production box
return false;
}
336. Consider we have overall 90% code coverage
however there is one class which has 0% code coverage. Can we still able to
deploy that class on production?
Yes. Minimum 1% required for every trigger and
there is no such restriction for Apex class.
338. In Ajax toolkit for custom Javascript button,
you have to explicitly login to API because global Session variable is not
available. In that case it is security vulnerable because anybody logged in can
see the javascript code and your username and password. So is there any way to
avoid this?
We can create a visualforce page with output
type as JavaScript. Global session variable is available in VF page.
Initialize the global javascript variable in
that VF page. include VF page as a javascript file and we are done!
339. In Custom Component How we can return value
to Custom Controller or Controller Extension?
In Apex, Objects are passed by reference. So supply an argument of wrapper class
(object) type to custom component. If its value is changed in Custom component
we will get updated value in controller also.
340. Let’s consider you had created outbound
changeset previously. After that, some class is modified which is part of that
old changeset. If you clone that Changeset, current updated class will be
included or that previous class will be included in changset? (This need to be
verified in recent versions)
Once changeset is created it cannot be
modified. After creation of changset, if we modify any component it will not
reflected and when we clone the changeset, all components (of course old copy
of component) will be added to changeset.
341. In trigger, let’s say we have system.debug()
statement after adderror() method. Will system.debug() be statement executed in
Trigger after adderror() method?
adderror() method is not error statement
rather its normal execution flow and all the statements written after
adderror() will be executed normally.
342. What will happen if you try to update record
in After Trigger Context?
You will get an error saying “record is Read
only”.
343. Can you use aggregate expressions inside
inner query?
Explanation – Can you use Group by clause inside inner query in SOQL?
Explanation – Can you use Group by clause inside inner query in SOQL?
Example: Something like :
SELECT Id, Name,(SELECT Count(Id),Name FROM Contacts Group By Name Havingcount(Id)
> 1 ) FROM Account
No. only root queries support aggregate
expressions. Return type is List<AggregateResult> for above query
However the root result expects List<Account> and there is no syntax or
provision available in Salesforce to specify that child results are of type
“AggregateResult“.
344. What is the best way to check whether
organization has PersonAccount enable or not using Apex?
Method 1:
// 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:
// 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' );
}
345. How to get selected records ID from List View
using Javascript / Ajax Toolkit, when custom button is added on List View page?
Create a new Button on Lead of type List
Button. Add the button on Lead List View Layout and write below Javascript
code:
{!RequireScript("/js/functions.js")}
var recordsSelected =
{!GetRecordIds($ObjectType.Lead)}
for(var i=0; i < recordsSelected .length
; i++) {
alert('Selected ID
'+recordsSelected[i]);
}
346. What is the default timeout period while
calling webservice from Apex.
10 sec.
347. A single Apex transaction can make how many
callouts to an HTTP request or an API call?
Maximum 10 callouts
348. How to increase timeout while calling web
service from Apex?
docSample.DocSamplePort stub
= new docSample.DocSamplePort();
stub.timeout_x = 2000; // timeout in
milliseconds
349. How to show loading image while Ajax call in
Visualforce? OR how to show image in <apex:actionStatus> tag in
Visualforce?
<div style="position:absolute;top:20px;left:
50%;">
<apex:actionStatus id="refreshContent" >
<apex:facet name="start" >
<apex:image url="{!$Resource.LoadingImage}" />
</apex:facet>
</apex:actionStatus>
</div>
350. How to add the Document Header in Visualforce
page?
Directly there is no way to add the document
type in visualforce. However in most of the cases IE9 does not work with
Visualforce pleasantly. And then we need to add the Document type in header. So
following workaround will work.
<apex:outputText escape="false"
value="{!'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">'}"/>
<html>
<head>
<title>test</title>
</head>
<body>test</body>
</html>
</apex:page>
351. Onchange event does not work with
<apex:actionsupport> 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.
352. If IE9 is not working with your custom
visualforce page then how to tell your visualforce code to run in IE8
compatibility mode?
Add following metatag to pages:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
353. It may happen that above tips will not work
as lots of time the page header already set. Then, how to achieve same result
using Apex?
Add below line of code in Apex (Constructor)
Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
354. How to display the formatted number / date in
Visualforce? Which component should be used?
Use component “<apex:outputText>”.
Example : Format the number into currency.
<apex:outputtext value="{0, number,
000,000.00}">
<apex:param value="{!valFromController}" />
</apex:outputtext>
OR
<apex:outputtext value="{0, number,
###,###.00}">
<apex:param value="{!valFromController}" />
</apex:outputtext>
355. 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 <apex:outputText> component display in clear text. The
<apex:outputText> component doesn’t respect the View Encrypted Data
permission for users. To prevent showing sensitive information to unauthorized
users, use the <apex:outputField> tag instead.
356. Will below query work? Explain.
SELECT COUNT(Id), Name,
Address__c FROM Opportunity GROUP BY Name
Above query will throw an error.
Explanation: In Group by clause the columns
selected must be either used in Group by clause or in aggregate functions. The
Name field is neither used in aggregate methods and in group by clause and
hence will result in error “Malformed Query”.
357. Explain difference in COUNT() and
COUNT(fieldname) in SOQL.
COUNT()
· 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.
358. 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“.
Example:
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%'
359. 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 :
<span id="focusDistraction"></span>
<script type="text/javascript">
/* prevent autopup of the
date inputfield by the default focus behavoir */
window.onload=function()
{
document.getElementById('focusDistraction').focus();
}
</script>
360. How to force lead assignment rule via Apex
while updating or adding the Lead?
To enforce Assignment Rules in Apex you will
need to perform following steps:
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);
361. 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:
Apex class:
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:
<apex:image url='stopsign.png' rendered="{!colorStatus
== StatusValue.RED}"/>
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
<apex:image url='stopsign.png' rendered="{!currentStatusValue
== 'RED'}" />
362. 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.
363. 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”.
364. 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”.
365. 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.
366. How to get the picklist value in Apex class?
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 <apex:selectOptions>.
Code Example:
Let’s say we have a custom object called
OfficeLocation__c. This object contains a picklist field Country__c.
The first thing we need to do, within our
controller is use the getDescribe() method to obtain information on
the Country__c field:
Schema.DescribeFieldResult fieldResult =
OfficeLocation__c.Country__c.getDEscribe();
We know that Country__c is a
picklist, so we want to retrieve the picklist values:
List<Schema.PicklistEntry> ple =
fieldResult.gerPicklistValues();
The only thing left for us to do is map the
picklist values into an <apex:selectOptions> tag can use for
display. Here is the entire method from our controller to do this:
public List<SelectOption>
getCountries()
{
List<SelectOption>
options = new List<SelectOption>();
Schema.DescribeFieldResult fieldResult =
OfficeLocation__c.Country__c.getDescribe();
List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
for(
Schema.PicklistEntry f : ple)
{
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return
options;
}
With our controller
logic all complete, we can call the getCountries() method from our Visualforce
page, and populate the <apex:selectList> tag:
<apex:selectList
id="countries" value="{!Office_Location__c.Country__c}"
size="1" required="true">
<apex:selectOptions
value="{!countries}"/>
</apex:selectList>
367. What are the types of controller in visual
force?
There are basically two types of Controller in
Visual force page.
1.
Standard Controller and
2. Custom Controller
368. 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.
Example:
<apex:page standardController="Account"
extensions="ExtOne,ExtTwo" showHeader="false">
<apex:outputText value="{!foo}" />
</apex:page>
if ExtOne and ExtTwo, both have the
method getFoo() then the method of ExtOne will be executed.
A controller extension is any Apex class that
contains a constructor that takes a single argument of
typeApexPages.StandardController or CustomControllerName, where
CustomControllerName is the name of a custom controller that you want to
extend.
369. 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.
Example :
System.runAs(u) {
// The following code runs as user 'u'
System.debug('Current User: ' +
UserInfo.getUserName());
System.debug('Current Profile: ' +
UserInfo.getProfileId()); }
// Run some code that checks record sharing
}
370. Explain Test.setPage().
It is used to set the context to current page,
normally used for testing the visual force controller.
371. Difference between SOSL and SOQL in
Salesforce ?
SOSL
|
SOQL
|
Stands for "Salesforce object search
language".
|
Stands for "Salesforce object query
language".
|
Works on multiple object at a same time.
|
Need to write different SOQL for different
object.
|
All fields are already text indexed.
|
SOQL against same field will be slow.
|
Cannot used in Triggers. Can only be used in
Apex class and anonymous block.
|
Can be used in Apex class and Triggers.
|
372. How to round the double to two decimal places
in Apex?
Decimal d = 100/3;
Double ans = d.setScale(2) ;
372. In how many ways we can invoke the Apex
class?
1. Visualforce page
2. Trigger
3.
Web Services
4.
Email Services
373. Can we create Master Detail relationship on
existing records?
No. As discussed above, first we have to
create the lookup relationship then populate the value on all existing record
and then convert it.
374. 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.
375. 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. we can achieve the database.insert
behavior in insert by using the method setOptions(Database.DMLOptions)
Important Difference:
· If we use the DML statement (insert), then in bulk operation if
error occurs, the execution will stop and Apex code throws an error which can
be handled in try catch block.
· If DML database methods (Database.insert) used, then if error occurs
the remaining records will be inserted / updated means partial DML operation
will be done
376. What is the scope of static variable?
When you declare 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.
377. Other than SOQL and SOSL what is other way to
get custom settings?
Other than SOQL or SOSL, Custom settings have
their own set of methods to access the record.
For example:If there is custom setting of name
ISO_Country,
SO_Country__c code =
ISO_Country__c.getInstance(‘INDIA’);
//To return a map of data sets defined for the
custom object (all records in the custom object), //you would use:
Map<String,ISO_Country__c> mapCodes =
ISO_Country__c.getAll();
// display the ISO code for India
System.debug(‘ISO Code:
‘+mapCodes.get(‘INDIA’).ISO_Code__c);
//Alternatively you can return the map as a list:
List<String> listCodes =
ISO_Country__c.getAll().values();
378. What happens if child have two master records
and one is deleted?
Child record will be deleted.
379. 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.
380. How to get the list of all available sobject
in salesforce database using Apex (Dynamic Apex)?
Map<String, Schema.SObjectType> m =
Schema.getGlobalDescribe();
381. How to create instance of sObject dynamically? Normally the
sObject is created like “Account a = new Account();”. But if you are in
situation that you don’t know which sObject is going to be instantiated? Means
it will be decided at runtime, how you will handle it?
public SObject getNewSobject(String t){
// Call global describe
to get the map of string to token.
Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
// Get the token for the
sobject based on the type.
Schema.SObjectType st = gd.get(t);
// Instantiate the
sobject from the token.
Sobject s = st.newSobject();
return s;
}
382. How to get all the fields of sObject using
dynamic Apex?
Map<String, Schema.SObjectType> m =
Schema.getGlobalDescribe() ;
Schema.SObjectType s =
m.get('API_Name_Of_SObject') ;
Schema.DescribeSObjectResult r = s.getDescribe()
;
Map<String,Schema.SObjectField> fields =
r.fields.getMap() ;
383. How to get all the required fields of sObject
dynamically?
There is no direct property available in Apex dynamic
API to represent the required field. However there is another way to know about
it.
If any fields have below three properties then
it is mandatory field.
1. If it is Creatable
2. If it is not nillable and
3.
If it does not have any default value
Map<String, Schema.SObjectType> m =
Schema.getGlobalDescribe() ;
Schema.SObjectType s = m.get(so.apiName) ;
Schema.DescribeSObjectResult r = s.getDescribe()
;
Map<String,Schema.SObjectField> fields =
r.fields.getMap() ;
for(String f : fields.keyset())
{
Schema.DescribeFieldResult
desribeResult = fields.get(f).getDescribe();
if(
desribeResult.isCreateable() && !desribeResult.isNillable()
&& !desribeResult.isDefaultedOnCreate() )
{
//This is mandatory / required field
}
}
384. 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.
private String name;
public void setName(String n)
{
name = n;
}
public String getName()
{
return name;
}
However, the Apex introduced the new concept
of property from language C# as shown below:
public String name {get; set;}
As we can see how simple the code is and
instead of using nearly 8 to 11 lines all done in 1 line only. It will be very
useful when lots of member is declared in Apex class. It has another advantage
in “number of lines of code” limit by salesforce which will drastically reduced.
385. 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.
386. Explain the need or 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.
Consider one example: If there is one
controller written and used by the multiple visualforce pages and one of them
needs some extra logic. Then instead of writing that logic to controller class
(Which is used by many visualforce pages) we can create a controller extension
and apply to that page only.
387. How to read the parameter value from the URL
in Apex?
Consider that the parameter name is
“RecordType”.
String recordType =
Apexpages.currentPage().getParameters().get('RecordType');
388. 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?
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.
389. What is the difference between trigger.new and trigger.old in
Apex – SFDC?
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
i.e., Trigger.new is available in before insert, after insert,
before update and after update
In Trigger.new 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.
390. 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;
}
}
}
}
394. What are Global variables explain with examples?
Global variables are the variables used to reference the general
information about the current user or your organization on a page.
Example:
Global variables must be referenced
using Visualforce expression syntax to be evaluated, for
example, {!$User.Name}.
List of available global variables are as
below
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
395. 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.
396. 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.
397. What is S-Control?
S-Controls are the predominant salesforce.com widgets which are
completely based on Javascript. These are hosted by salesforce but executed at
client side. S-Controls are superseded by Visualforce now.
398. 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.
399. Will Visual force still supports the merge fields usage
like S-control?
Just like S-Controls, Visualforce Pages support embedded merge
fields, like the {!$User.FirstName} used in the example.
400. 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}
401. 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, https://ap1.salesforce.com/apex/MyTestPage.you 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.
402. 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.
403. 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);
404. What are different APIs in salesforce.com?
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 Force.com IDE or Force.com 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 Force.com 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 Force.com 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.
405. How to display error message on Visualforce page?
In the Visualforce page add the tag:
<apex:pageMessages
/>
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'));
}
406. What is Visualforce View State? And what are best practices to
reduce the view state size?
Visualforce 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.
407. 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.
There are two types of custom settings:
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.
408. What is APEX?
It is the in-house technology of salesforce.com which is similar
to Java programming with object oriented concepts and to write our own custom
logic.
• Apex is a procedural scripting language in
discrete and executed by the Force.com platform.
• It runs natively on the Salesforce servers,
making it more powerful and faster than non-server code, such as
JavaScript/AJAX.
• It uses syntax that looks like Java
• Apex can written in triggers that act like
database stored procedures.
• Apex allows developers to attach business
logic to the record save process.
• It has built-in support for unit test
creation and execution.
Apex provides built-in support for common
Force.com platform idioms, including:
• Data manipulation language (DML) calls, such
as INSERT, UPDATE, and DELETE, that include built-in DmlException handling
• Inline Salesforce Object Query Language
(SOQL) and Salesforce Object Search Language (SOSL) queries that return
lists of sObject records
- Looping that allows for bulk processing of
multiple records at a time
- Locking syntax that prevents record update
conflicts
- Custom public Force.com API calls that can
be built from stored Apex methods
- Warnings and errors issued when a user tries
to edit or delete a custom object or field that is referenced by Apex
Note: Apex is included in Unlimited Edition,
Developer Edition, Enterprise Edition, and Database.com
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.
Apex vs. Java: Differences
• Apex runs in a multi-tenant environment and
is very controlled in its invocation and governor limits.
• To avoid confusion with case-insensitive
SOQL queries, Apex is also case-insensitive.
• Apex is on-demand and is compiled and
executed in cloud.
• Apex is not a general purpose programming
language, but is instead a proprietary language used for specific business
logic functions.
• Apex requires unit testing for development
into a production environment.
409. Explain the Apex Data Manipulation Language (DML) Operations?
Use data manipulation language (DML) operations to insert,
update, delete, and restore data in a database.
You can execute DML operations using two
different forms:
Apex DML statements, such as:
insertSObject[]
Apex DML database methods, such as:
Database.SaveResult[] result =
Database.Insert(SObject[])
While most DML operations are available in
either form, some exist only in one form or the other.
The different DML operation forms enable different types of
exception processing:
· Use DML statements if
you want any error that occurs during bulk DML processing to be thrown as
an Apex exception that immediately interrupts control flow (by
using try. . .catch blocks). This behavior is similar to the way
exceptions are handled in most database procedural languages.
· Use DML database methods if you want to allow partial success of a bulk DML operation—if a record fails, the remainder of the DML operation can still succeed. Your application can then inspect the rejected records and possibly retry the operation. When using this form, you can write code that never throws DML exception errors. Instead, your code can use the appropriate results array to judge success or failure. Note that DML database methods also include a syntax that supports thrown exceptions, similar to DML statements
Pie chart and Bar chart using Apex in Visualforce page
Sample Code:
Visualforce page:
<apex:page controller="Graph" >
<apex:pageblock title="Members and their Years of experience" >
<apex:chart height="250" width="350" data="{!pieData}">
<apex:pieSeries tips="true" dataField="data" labelField="name"/>
<apex:legend position="bottom"/>
</apex:chart>
</apex:pageblock>
<apex:pageblock title="Members and their Years of experience" >
<apex:chart height="250" width="350" data="{!pieData}">
<apex:axis type="Numeric" position="left" fields="data" title="Years of experience"/>
<apex:axis type="Category" position="bottom" fields="name" title="Member"/>
<apex:barSeries orientation="vertical" axis="left" xField="name" yField="data"/>
</apex:chart>
</apex:pageblock>
</apex:page>
Apex Controller:
public with sharing class Graph
{
public List<PieWedgeData> getPieData()
{
List<PieWedgeData> data = new List<PieWedgeData>();
List<Member__c> memb = new List<Member__c>();
String sql = 'SELECT Name, Year_s_Of_Experience__c FROM Member__c';
memb = Database.Query(sql);
for(Member__c temp:memb)
{
data.add(new PieWedgeData(temp.Name,temp.Year_s_Of_Experience__c));
}
return data;
}
// Wrapper class
public class PieWedgeData
{
public String name { get; set; }
public Decimal data { get; set; }
public PieWedgeData(String name, Decimal data)
{
this.name = name;
this.data = data;
}
}
}
Output:
Visualforce page:
<apex:page controller="Graph" >
<apex:pageblock title="Members and their Years of experience" >
<apex:chart height="250" width="350" data="{!pieData}">
<apex:pieSeries tips="true" dataField="data" labelField="name"/>
<apex:legend position="bottom"/>
</apex:chart>
</apex:pageblock>
<apex:pageblock title="Members and their Years of experience" >
<apex:chart height="250" width="350" data="{!pieData}">
<apex:axis type="Numeric" position="left" fields="data" title="Years of experience"/>
<apex:axis type="Category" position="bottom" fields="name" title="Member"/>
<apex:barSeries orientation="vertical" axis="left" xField="name" yField="data"/>
</apex:chart>
</apex:pageblock>
</apex:page>
Apex Controller:
public with sharing class Graph
{
public List<PieWedgeData> getPieData()
{
List<PieWedgeData> data = new List<PieWedgeData>();
List<Member__c> memb = new List<Member__c>();
String sql = 'SELECT Name, Year_s_Of_Experience__c FROM Member__c';
memb = Database.Query(sql);
for(Member__c temp:memb)
{
data.add(new PieWedgeData(temp.Name,temp.Year_s_Of_Experience__c));
}
return data;
}
// Wrapper class
public class PieWedgeData
{
public String name { get; set; }
public Decimal data { get; set; }
public PieWedgeData(String name, Decimal data)
{
this.name = name;
this.data = data;
}
}
}
Output:
411.Sample Visualforce page and apex controller to display account records based on selected picklist value
note: you can directly copy paste into you developer org
Visualforce Page:
<apex:page standardController="account" extensions="CustomReport"> <apex:form > <apex:pageBlock > <apex:pageBlockSection > <apex:inputField value="{!account.type}" styleClass="relative"> <apex:actionSupport event="onchange" action="{!recordValues}" reRender="val"/> </apex:inputField> </apex:pageBlockSection> <apex:dataTable value="{!acc}" var="var" id="val"> <apex:column value="{!var.name}" headerValue="Name"/> <apex:column value="{!var.type}" headerValue="type"/> <apex:column value="{!var.industry}" headerValue="industry"/> </apex:dataTable> </apex:pageBlock> </apex:form> </apex:page>
Apex Controller:
public with sharing class CustomReport
{
public list<account> acc{set;get;}
public account acct{set;get;}
public CustomReport(ApexPages.StandardController controller)
{
this.acct = (Account)controller.getRecord();
}
public void recordValues()
{
acc=[select id,name,type,industry from account where type=:acct.type];
}
}
Salesforce Lightning:
1. create domain name for your org :
setup
|-----Adminster
|--------Domain Management
|--------------MyDomain
a. Enter Domain Name
b. Check availabilty
c. Register
4. Click on login button to test the connection
5. Deploy to users so that users can login using this domain url
2. create package : This is optional ,but if you want to provide lightning apps to the external system or if you want to provide this lightning application as Appexchange product then Package creation is a must
=============================================================================================================
Lishtning Application
============================================================================================================
1. Steps to create lightning Application
UserName
|----Developer Console
|---File
|-----Lightning App
|---App name
Note : All the lightning applications will have an extention of .app
Ex: <aura:application>
This is a test application
</aura:applicaiton>
2. <aura: applicaiton >
1. Every lightning application will start and end with <aura:applicaiton> component .
Arributes :
a)access : indicates whether this app can be extended by another app outside of a namespace.
possible values : global and public
b)controller: This is will take name of the Apex class whose functionalities are used in this application..
If you create namespace : :namespace.className.
if you dont create namespace : classname
c.extends:name of the app which need to be extended .
d.extensible:Indicates whether this app can be extended by another app.
possible values : true /false
e)implements:It will take the list of interfaces that the application want to implements.
Ex : implements ="one,two,three"
Note : App can implement more than one interface
=============================================================================================================
Component :
=============================================================================================================
1.<aura:component> :
a. Components are the functional units of Aura,
b. These components encapsulate modular and reusable sections of UI.
c. They can contain other components or HTML markup.
Syntax:
<aura:component>
<!-- Optional component attributes here -->
<!-- Optional HTML markup -->
</aura:component>
d.Attributes :
1)access:indicates whether this component can be extended by another app outside of a namespace.
possible values : global and public
2)controller : This is will take name of the Apex class whose functionalities are used in this Component.
If you create namespace : :namespace.className.
if you dont create namespace : classname
3)extends:name of the component which need to be extended .
4)extensible:Indicates whether this componnent can be extended by another component.
possible values : true /false
5)implements: It will take the list of interfaces that the component want to implements.
Ex : implements ="one,two,three"
Note : Componnet can implement more than one interface
e. Steps to create aura: componet
UserName
|------Developer console
|----File
|----Lightning Componet
|--------------Component Name
Example : capital1.cmp
<aura:component >
<h1> This is a line one </h1>
<h2> This is line two</h2>
<h3> This is line three</h3>
</aura:component>
f. How to invoke the component in the application ;
1. if the you have created any namespace then is should be called using namespace
<namespace: componentName >
Ex: if namespace : capitalInfosol
component name is : example1
<capitalinfosol : example1>
2) if you dont have the namespace then it will be called using defualt namespace i.e c
<c: example1>
Example : one .app
<aura:application >
This is a test app
<c:capital1></c:capital1>
</aura:application>
============================================================================================================
Example 1 : Create an application with multiple components
============================================================================================================
a . Create a new component : student
<aura:component >
<h1> Iam new Student </h1>
<div> This is a test component</div>
</aura:component>
b. create a new component studentAddress
<aura:component >
<div>
Ameerpet <br/>
SRNagar <br/>
Hyd <br/>
TG <br/>
</div>
</aura:component>
c. Create new Application : app2
<auar: application >
<c:student />
<c:studentAddress />
</aura:application>
===========================================================================================================
Example 2: Applying CSS on component
===========================================================================================================
1. create a Component : csscomp.cmp
<aura:component >
<h1> This is line one </h1>
<div class="red"> This is red</div>
<div class="green"> This is green</div>
<div class="blue"> This is blue</div>
</aura:component>
2. Style : Click on Style button on the right side wizard
:Then it creates csscomp.css
.THIS {
background-color:yellow;
padding-top : 40px;
padding-left :40px;
}
.THIS.red {
background-color: red;
}
.THIS.blue {
background-color: blue;
}
.THIS.green {
background-color: green;
}
3. Application : capital3
<aura: application>
<c:csscomp> </c:csscomp>
<aura :application>
=====================================================================================================
Creating attributes for a component
===================================================================================================
<aura:attribute>
aura:attribute is used to create an attribute on an app, interface, component, or event.
Attributes :
a) access:Indicates whether the attribute can be used outside of its own namespace.
b) name :Required.The name of the attribute.
c) type :Required. The type of the attribute.
Possible values (Date,DateTime,Decimal,Double,Integer ,Long ,string ,Boolea )
d) defualt: Value that should be assingned to the attribue if no values are assigned to it.
e) description: A summary of the attribute and its usage
f) required : Specified wheather attribute value need to be required to run this component.
Example :
<aura: attribue name="empName" type="String" defualt="capitalinfo" required="true" />
Examples :
<aura:component >
<aura:attribute name="empName" type="string" />
<aura:attribute name="salary" type="Decimal" required="true" />
<aura:attribute name="city" type="string" default="Hyd" />
<aura:attribute name="phones" type="String[]" description="This contains all phone numbers of account" />
</aura:component>
How to read the values of attributes in the component / appliation
1. we get the values of the atrributes using {! v.attributeName}
Ex : {! v.empName }
Ex :{! v.salary}
Ex :{! v.city}
Ex :{! v.phone}
Example : How to pass the values of the component from application .
a. Create a new Component :employee.cmp
<aura:component >
<aura:attribute name="name" type="string" required="true"/>
<aura:attribute name="exp" type="Decimal" />
<aura:attribute name="City" type="String" default="Hyd" />
<div>
Employee Name : {! v.name} <br/>
Employee Exp : {! v.exp} <br/>
Employee City :{! v.city}
</div>
</aura:component>
b. create style for the component : employee.css
.THIS {
padding-top: 40px;
padding-left:80px;
color: blue;
}
c. Create an application : capital.4
<aura:application >
<c:employee name="Satish Myla" exp="3.4" />
</aura:application>
=============================================================================================================
<aura:handler>
a. This component is used to intialize the values /attributes in the component /application
b. This event istriggered on app or component for initialization.
c. This event is automatically fired when an app or component is has initializations prior to rendering. T
Attributes :
a .name : It should be alwasys "init" only
b. value : This should be assined {! this}
c. action :The client-side controller action that handles the value change.
Syntax :
<aura:handler name="init" value="{!this}" action="{!c.functionname} " />
Syntax of controller :
(
{
methodname :function(component)
{
}
})
Q:: How to read the values of attributes with in the controller
component.get("v.attributename");
Q:: How to set the values of attributes with in the controller
component.set("v.attribute" ,value);
============================================================================================================
Example 1:
a. Create a component with three attributes aval,bval,cval
Calculate.cmp
<aura:component >
<aura:attribute name="aval" type="Integer" required="true" />
<aura:attribute name="bval" type="Integer" required="true"/>
<aura:attribute name="cval" type="Integer" />
<aura:handler name="init" value="{!this}" action="{!c.add}" />
<div>
<h2> AVal : {!v.aval}</h2>
<h2>BVal :{!v.bval}</h2>
<h2>CVal :{!v.cval}</h2>
</div>
</aura:component>
b. create style for the component :
.THIS {
padding-left :80px;
padding-top :80px;
color :green;
}
c. create a clientside controller by clicking controller button on right side menu wizard
calculate.js
({
add : function(component) {
var aval=component.get("v.aval");
var bval=component.get("v.bval");
var cval=aval+bval;
component.set("v.cval",cval);
}
})
d. crate new application capital.app
<aura:application >
<c:calculate aval="10" bval="10" />
</aura:application>
Examples 2 :
a. create a new custom component :
empcomp
<aura:component >
<aura:attribute name="empName" type="string" default="Enter Name" />
<aura:handler name="init" value="{!this}" action="{!c.show}" />
Employee Name :{! v.empName}
</aura:component>
b. createa client side Controller:
({
show : function(component) {
component.set(" v.empName "," Satish Myla ");
}
})
c create a Application :
<aura:application >
<c:empcomp> </c:custom1>
</aura:application>
Example 3:
a. create custom component : intrestcalcualte
<aura:component >
<aura:attribute name="empName" type="string" default="Enter Name" />
<aura:attribute name="amount" type="decimal" />
<aura:attribute name="rate" type="integer" />
<aura:attribute name="years" type="integer" />
<aura:attribute name="intrest" type="decimal" />
<aura:handler name="init" value="{!this}" action="{!c.calculate}" />
<div>
Employee Name :{! v.empName} <br/>
Amount : {!v.amount} <br/>
Rate : {!v.rate} <br/>
Years :{! v.years} <br/>
Intrest:{! v.intrest}
</aura:component>
b. create a css style for a component ;
.THIS {
padding-left :80px;
padding-top :80px;
color :green;
}
c. create a clinet side controller
({
calcualte : function(component) {
component.set("v.empName","satish myla");
var amount=component.get("v.amount");
var years=component.get("v.years");
var rate=component.get("v.rate");
var intrest=amount*years*rate/100;
component.set("v.intrest",intrest);
}
})
d. create an application
<aura:application >
<c:intrestcalcualte amount="10000" rate="10" years="2"></c:comp3>
</aura:application>
=============================================================================================================
How to refer to array of elements :
===========================================================================================================
<aura:iteration> :
1. This component is used to display collecton elements by iterating over every element
Attribues :items: Required. The collection of data to iterate over.
var : Required. The variable name to use for each item inside the iteration.
Example 1:
1. create custom component :
collection1:
<aura:component>
<aura:iteration items="1,2,3,4,5" var="item">
<h1>Items : {!item}</h1>
</aura:iteration>
</aura:component>
2. Create a applicaiton : capital6
<aura:application>
<c:collection1 />
</aura:application>
Example 2:
1. create custom component : collection2.cmp
<aura:component >
<aura:attribute name="names" type="string[]" default="['Ram','Ravi','Kiran']" />
<aura:iteration items="{!v.names}" var="s">
<h1> Employee Name :{!s} </h1>
</aura:iteration>
</aura:component>
2. Application :
<aura:application >
<c:collection2></c:collection2>
</aura:application>
Example 3:
1. create a custom component :
<aura:component >
<aura:attribute name="names" type="string[]" />
<aura:handler name="init" value="{!this}" action="{!c.callme}" />
<aura:iteration items="{!v.names}" var="s">
<h1> Employee Name :{!s} </h1>
</aura:iteration>
</aura:component>
2. create custom controller
({
callme : function(component) {
var names=['Ram','Kiran','Hari'];
component.set("v.names",names);
}
})
3. create new Application
<aura:application >
<c:collection3></c:collection3>
</aura:application>
==============================================================================================================
Example : Creating Form using UI components in Lightning
1. create the component to create UI comonents
<aura:component >
<ui:inputNumber label="Amount" placeholder="0" /><br/>
<ui:inputText label="Enter Name" placeholder="FirstName,Last" /><br/>
<ui:inputCurrency label="Salary " /> <br/>
<ui:inputDateTime label="Date" displayDatePicker="true"/>
<ui:button label="Submit" />
</aura:component>
2. create a application
<aura:application >
<c:uicomponent1 />
</aura:application>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Q:: Setting and getting values of component using id in the controller method
component.find("idname").get("v.value");
component.find("idname").set("v.value",value);
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Example 1:
1. create a component :uicomponent2
<aura:component >
<ui:inputText label="Enter Name" placeHolder="Employee Name" aura:id="name" />
<ui:inputText label="My Name " aura:id="myname" />
<ui:button label="submit" press="{!c.callme}" />
</aura:component>
2. create a controller :
({
callme : function(component) {
var name=component.find("name").get("v.value");
component.find("myname").set("v.value",name);
}
})
3. Create a application :
<aura:application >
<c:uicomponent2 />
</aura:application>
Example 2 :
<aura:component >
<ui:inputText label="Name" aura:id="name" placeholder="First, Last"/>
<ui:button aura:id="outputButton" label="Submit" press="{!c.getInput}"/>
<ui:outputText aura:id="nameOutput" value=""/>
</aura:component>
Controller :
({
getInput : function(cmp, event) {
var fullName = cmp.find("name").get("v.value");
var outName = cmp.find("nameOutput");
outName.set("v.value", fullName);
}
})
Application :
<aura:application >
<c:comp5></c:comp5>
</aura:application>
=============================================================================================
Example 9 :set the attribute values from the UI components based on the events on componets
<aura:component >
<aura:attribute name="first" type="String" default="John"/>
<aura:attribute name="last" type="String" default="Doe"/>
<ui:inputText label="First Name" value="{!v.first}" updateOn="keyup"/>
<ui:inputText label="Last Name" value="{!v.last}" updateOn="keyup"/>
<!-- Returns "John Doe" -->
<ui:outputText value="{!v.first +' '+ v.last}"/>
</aura:component>
Application :
<aura:application >
<c:comp6></c:comp6>
</aura:application>
==========================================================================================
Example 10:Creating a picklist component
<aura:component >
<ui:inputSelect>
<ui:inputSelectOption text="Red"/>
<ui:inputSelectOption text="Green" value="true"/>
<ui:inputSelectOption text="Blue"/>
</ui:inputSelect>
</aura:component>
Application :
<aura:application>
<c:compPick></c:compPick>
</aura:application>
============================================================================================
Example 12: If Else in the lightning
<aura:component >
<aura:attribute name="edit" type="Boolean" default="true"/>
<aura:if isTrue="{!v.edit}">
<ui:button label="Edit"/>
<aura:set attribute="else">
No button
</aura:set>
</aura:if>
</aura:component>
Application :
<aura:application>
<c:comp8></c:comp8>
</aura:application>
==========================================================================================
Reading the data from the Apex Class:
1. Every method of the apex which we want to invoke in the lightning should obey the following rules
a . Method should be annotated with @AuraEnabled
b. Method should be static method
c. Method should have returnType to pass the data
2. If you want to the apex class in the lightning component / application it should be define as a controller
3.When we want to invoke the reffer to the server-side controller method from the client side controller
method
Syntax :
component.get("c.methodName");
4. When want to the setCallback of to the controller
var mycall=component.get("c.methodName");
myCall.setcallback(this, function(response) {
logic
});
5.When the method gives the reponse check the status
var state=response.getStatus();
6.Every apex method invocation from the controller javascript is asynchronous so we need to
enqueu the job;
$A.enqueueAction(action);
Example :
1. Create a apex class with aura enabled methods
Apex class : AuraExample1
public class AuraExample1 {
@AuraEnabled
public Static String getName(){
return 'Satish Myla';
}
}
2. create a custom Componet which invokes the apex class
<aura:component controller="AuraExample1">
<aura:attribute name="empName" type="string" />
<ui:button label="Get EmpData" press="{!c.show}"/>
<h1>Employee Name :{! v.empName} </h1>
</aura:component>
3. create a client side controller
({
show : function(component) {
var action=component.get("c.getName");
action.setCallback(this, function(response){
var state = response.getState();
if (state === "SUCCESS") {
component.set("v.empName", response.getReturnValue());
}
});
$A.enqueueAction(action);
}
})
4. create a application
<aura:application >
<c:apexcall />
</aura:application>
===============================================================================================
Example 14: Reading a list account records from Sobject and display in Lightning
Apex class : AuraExample2:
public class AuraExample2 {
@AuraEnabled
public Static Account[] getAccounts(){
List<Account> accs=[select id,name from Account limit 4];
return accs;
}
}
Component : Custom5 :
<aura:component controller="AuraExample2">
<aura:attribute name="Accounts" type="Account[]" />
<ui:button label="Get Accounts" press="{!c.getAccs}"/>
<aura:iteration var="a" items="{!v.Accounts}">
<p>{!a.Name} : {!a.Id}</p>
</aura:iteration>
</aura:component>
Controller:
({
getAccs: function(cmp){
var action = cmp.get("c.getAccounts");
action.setCallback(this, function(response){
var state = response.getState();
if (state === "SUCCESS") {
cmp.set("v.Accounts", response.getReturnValue());
}
});
$A.enqueueAction(action);
}
})
Application :
<aura:application >
<c:custom5></c:custom5>
</aura:application>
==============================================================================================
Example 15 :Setting the body part of the component
-------------------------------------------------------------------
<aura:component>
<aura:set attribute="body">
<!--START BODY-->
<div>Body part</div>
<ui:button label="Push Me"/>
<!--END BODY-->
</aura:set>
</aura:component>
App6.app
<aura:application >
<c:bodyAttribute></c:bodyAttribute>
</aura:application>
-------------------------------------------------------------------------
Example 16: Component Facets
-------------------------------------------------------------------------
facetHeader.cmp
<aura:component>
<aura:attribute name="header" type="Aura.Component[]"/>
<div>
<span class="header">{!v.header}</span><br/>
<span class="body">{!v.body}</span>
</div>
</aura:component>
facetHeaders.cmp
<aura:component>
See how we set the header facet.<br/>
<c:facetHeader>
Nice body!
<aura:set attribute="header">
Hello Header!
</aura:set>
</c:facetHeader>
</aura:component>
Application
<aura:application >
<c:facetHeaders></c:facetHeaders>
</aura:application>
========================================================================================
Example 17 : Adding lightning application in vf page
<aura:application access="GLOBAL" extends="ltng:outApp">
<aura:dependency resource="ui:button"/>
</aura:application>
VF Page :
<apex:page>
<apex:includeLightning />
<div id="lightning" />
<script>
$Lightning.use("c:app15", function() {
$Lightning.createComponent("ui:button",{ label : "Press Me!" },
"lightning",function(cmp) {});
});
</script>
</apex:page>
Thanks....
By Srinivas Madicharla