Salesforce Interview Questions – Part 6

51. Explain Permission sets released in Winter 12.
Ans :
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.

52. 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, 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 and they would load the Oracle ID into that field for each account. They can then refer to that ID field, rather than the 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 reccomended, 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 absenor 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” i 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.

Salesforce - External Id option while creating field
Salesforce – External Id option while creating field

53. How to get the picklist value in Apex class?
Ans :
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>.

54. What are the types of controller in visual force?
Ans :

There are basically two types of Controller in Visual force page.

  1. Standard Controller and
  2. Custom Controller

55. How many Controllers can be used on single VF page?
Ans :

Only one controller can be used salesforce. Other than them, Controller extension can be used. There may be more than one Controller extention.
Example :

<apex:page standardController="Account"
extensions="ExtOne,ExtTwo" showHeader="false">
<apex:outputText value="{!foo}" />

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 type ApexPages.StandardController or CustomControllerName, where CustomControllerName is the name of a custom controller that you want to extend.

56. Explain System.runAs()
Ans :

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

57. Explain Test.setPage().

It is used to set the context to current page, normally used for testing the visual force controller.

58. What is the custom settings ?
Ans :

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 Web services API.

59. Types of the custom settings?
Ans :

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. Examples of list data include two-letter state abbreviations, international dialing prefixes, and catalog numbers for products. 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.

60. Difference between SOSL and SOQL in Salesforce ?
Ans :

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.



, ,



Related Posts


3 responses to “Salesforce Interview Questions – Part 6”

  1. Harikrishna0464 Avatar

    hi i’m a B.Tech graduate of 2010 from Electronics & Communication .can anyone suggest me which course is better in SAP BI & Cloud computing

    1. Sreddy Yeruva Avatar
      Sreddy Yeruva

      Cloud Computing as easy when it compared with SAP and Seibel.For job orientation cloud computing has better opportunities in the market right now.

  2. […] 1 | Part – 2 | Part – 3 | Part – 4 – Dynamic Apex | Part – 5 | Part – 6 | Part – […]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Jitendra Zaa

Subscribe now to keep reading and get access to the full archive.

Continue Reading