Monday, April 6, 2015

Basic Salesforce Intetview questions part 1

1. For which criteria in workflow "time dependent workflow action" cannot be created?
   Ans: every time recordis created  and  it’s edited
   
   
2. What is the advantage of using custom settings and how many ways you can use it?

  
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 SOAP API.

Custom setting is the Hidden Gem of Salesforce where we can do miracles by  modifying bit peace of code..

    2.1) How  Many Types of custom settings ?
  
Basically there are two types of custom settings they are 

a) List
b) Hierarchy

  2.2) Apart from controlling Cost of repeated quries what else we can do with custom settings?

  4 scenarios expalined 

 scenario1 )  


 there are 2 profiles standard user and marketing user.  business need standard account UI (creation page,detail page       and edit page)  for  standard user  and  custom vf creation page,detail page and edit page for marketing user.  In this         scenario clearly we need Hierarchal custom setting to make it possible.

 scenario 2)  

 Business need to access third party application where the url and credentials of the  third  party application may vary from one instance to another instance.

 when ever you switch to different  instance, instead of substituting the credentials and url  in  the code ...admin just need to enter valid url and credentials of the third party system in the  custom settings as developer already called the custom settings in the code. 

 scenario 3)

 Business need to exclude few fields of the account object in the code where fields  may vary acording to  the business changes. Instead of asking CR(Change request every  time fields gets changed) admin can include or exclude  those fields in the custom settings without  developer intervention. you can substitute these fields acording to your requirement.



 scenario 4)  
You’re writing a trigger that sets a “Customer Service Rep” field on an Account every time there’s a high value Opportunity associated with it. Two things are certain: (1) The CSR on duty changes every week and (2) the threshold for a “high value” opp changes often since your company is expanding.
A perfect use case to use Custom Settings to set the CSR on duty and the “high value” opp threshold!
Benefits of using Custom Settings:
Change your variables through Salesforce.com without deploying code!
Any non-coder admin can now modify your variables and change how your code works!
Show your boss that you’re thinking ahead and not just concerned with doing the bare minimum!


Navigate to your Custom Setting >> Manage >> New

trigger AddCSR on Opportunity (before insert) {
// Grab your Custom Setting values
CSR_Settings__c settings = CSR_Settings__c.getInstance('csr');
String CSR_USER_ID = settings.CSR_User_ID__c;
Decimal OPP_MIN_VALUE = settings.Opp_Minimum_Value__c;
// Create a master list of accounts to bulk update
List<Account> accounts = new List<Account>();
for (Opportunity opp : Trigger.new) {
// Make sure we meet the minimum threshold
if (opp.Amount >= OPP_MIN_VALUE) {
// This is a trick to get the related account!
Account acc = new Account();
acc.Id = opp.AccountId;
// Update the CSR and add to master list
acc.CSR__c = CSR_USER_ID;
accounts.add(acc);
}
}
// Update the master list of accounts
update accounts;
}
Setup >> Develop >> Custom Settings >> New
Step 1: Create a Custom Setting “object” for your trigger:
Step 2: In your Custom Setting object, create Custom Fields for each needed variable:
Step 3: Create a Custom Setting record and edit its variables
Step 4: Use your Custom Setting in your code!
Now if you need to edit the CSR on duty or the minimum Opportunity amount threshold, simply edit the record in Step 3 – no rewriting or deploying code necessary!
One important note – custom Settings aren’t automatically transferred between sandboxes and production, so make sure you include them in both places or your code will break!
3. What are the different workflow actions available in workflows?
    Ans: 1. Field update 2. Email alert 3. send Outbound messages 4. Create new task


4. What is whoid and whatid in activities?
   Ans: Whoid is the id of either contact or Lead. Whatid is the id of the related to record in activity record(standard or custom object)
   
   
5. What is the difference between a standard controller and custom controller
    Ans: standard controller inherits all the standard object properties, standard button functionalities can be directly used. Custom controller defines custom functionalities, a standard controller can be extended to develop custom functionalities using keyword "extenssions"


6. Can you have more than one extenssions associated with a single page?
    Ans : Yes we can have more than extenssions.


7. If page is having multiple extenssions and if two extenssions have methods of same name.     Then which method out of these two will be called upon calling from vf page ?
 Ans: The one which is present in the controller defined on the left side will be called.


8. What are governer limits ?
    Ans: Governer limits are the limits imposed by salesforce so as to avoid monopoly by orgs in using salesforce shared resources.


9. how can we implement pagination in visualforce ?
   Ans: use standardset controllers for implementing pagination.
   
   
10. What is the difference between force.com and salesforce.com
      Ans: force.com is paas(platform as a service) and salesforce.com is Saas(software as a service)
 
 
11. What is a externalid in salesforce
      Ans: It is a field which can be used to store a value that is used as a refernce for that record in other system. For example if you have a record in system 'xyz' where it is referenced by some value then that value can be used as external id in salesforce for that record. External id can be used for upsert operation in data loader
 
 
12. What happens upon lead conversion ?
      Ans: When lead is converted a contact, account and optionally an opportunity is created.
 
 
13. What are different ways of deployment in salesforce ?
      Ans: Change sets, eclipse and ANT
 
 
14. How can you override a list button with a visuaflorce page?
      Ans: Visualforce page should be a list controller that is it should have "recordsetVar" attribute defined in page tag.
 
 
15. Is it possible to bypass Grant Access Using Hierarchies in case of standard objects ?
     Ans : No. This is default and cannot be changed.

1 comment: