anusha(salesforce developer)

Sunday 19 June 2016

Deloitte interview Q & A

    Why Governor Limits are introduced in Salesforce.com?


Because Apex runs in a multi tenant environment, the Apex run time engine strictly enforces a number of limits to ensure that runaway Apex does not monopolize shared resources. If some Apex code ever exceeds a limit, the associated governor issues a run time exception that cannot be handled.
.       What Sharing Rules?
– Automated rules that grant access to groups of users
– Exceptions to Organization Wide Defaults
– Irrelevant for Public Read/Write organizations
– Levels of Access that can be granted
• Read Only
• Read/Write
  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.
Lead Conversion?
– Lead qualification depends on your business process
– Lead information is mapped to the appropriate business object – Account, Contact or Opportunity
– Existing data check
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.

8.   Can we use a Checkbox as controlling field?
Yes you can use Checkbox with a dependent picklist however Checkbox fields can be controlling fields but not dependent fields.

you can try this  -

On an Object , Create a Checkbox field D1__c , Create a Picklist field D2__c ,
Under the Custom fields and Relationship Section Click the 'Field Dependencies' button, Click New
In the controlling Field choose D1 and in Dependent field Choose D2

The page that opens next is very self explanatory. follow the instructions and you'll learn that Checkbox can be used in a dependent picklist.

  What is Sales cloud & Service cloud?
"Sales Cloud" refers to the "sales" module in salesforce.com. It includes Leads, Accounts, Contacts, Contracts, Opportunities, Products, Price books, Quotes, and Campaigns (limits apply). It includes features such as Web-to-lead to support online lead capture, with auto-response rules. It is designed to be a start-to-end setup for the entire sales process; you use this to help generate revenue.

"Service Cloud" refers to the "service" (as in "customer service") module in salesforce.com. It includes Accounts, Contacts, Cases, and Solutions. It also encompasses features such as the Public Knowledge Base, Web-to-case, Call Center, and the Self-Service Portal, as well as customer service automation (e.g. escalation rules, assignment rules). It is designed to allow you to support past, current, and future clients' requests for assistance with a product, service, billing, etcetra; you use this to help make people happy.

The differences between Sales Cloud and Service Cloud are the same across each "edition" ("professional", "enterprise" and "unlimited"), mainly outlined above. The differences, as you can gather from the prior paragraphs, is that each cloud is designed to support a specific set of features that you would use to sell services and products, and support those services and products (respectively).

The main differences you will find are the limits between each edition. Professional Edition provides basic functionality; you can create limited customized UI pages (Visualforce), and you can use standard automation (e.g. assignment, escalation, and auto-response rules). Enterprise Edition provides additional features, including custom automation (e.g. workflow rules, Apex Code), improved Visualforce functionality, integration (API) access, generally increased limits, and additional customization features (e.g. more fields per object). Unlimited Edition is an extension of Enterprise Edition, and includes more storage space, premier support, more objects, increased API limits, and so on.
      
    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 Web services API.
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.
      How will you test your code through Sandbox?

You can force a run of all tests when deploying using the Force.com migration tool which is a wrapper over Ant. Set runAllTests=true when deploying to simulate a production like deployment where all tests are run while deploying. To rollback if test classes fail, set the rollBackOnError deployment option to true.

Here is the reference documentation, please see page 17 (Deploying Code)http://www.salesforce.com/us/developer/docs/daas/salesforce_migration_guide.pdf

    What is 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 :
1
System.runAs(u) {
2
// The following code runs as user 'u'

3
System.debug('Current User: ' + UserInfo.getUserName());
4
System.debug('Current Profile: ' + UserInfo.getProfileId()); }

5
// Run some code that checks record sharing
6
}

     Explain Test.setPage ()?
    It is used to set the context to current page, normally used for testing the visual force controller 

     What is 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 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
 How many records we can import using Import Wizard?
         
Dataloader
Import Wizard
     It supports more than 50000  records.
     It supports only up to 50000.
     It supports almost all standard and custom objects.
    It supports Custom objects but only few Standard objects like Accounts, Solutions, Leads and Contacts.
     It doesn’t support schedule  export.
     It supports schedule export.
     Delete operation is available.
      Delete operation is not available.
    It requires installation.             
     It doesn’t require installation.
    While importing, duplicates cannot be ignored.
     While importing, duplicates can be ignored.

  •    What we use if we want to import more than 50,000 records?
  •     What is Custom link?
   

  What are the ways of deployment?
Changes Sets Considerations

·         You can move metadata only between the production org and its sandboxes. You can’t move changes between two production orgs or Developer Editions.
·         You can add components with a change set, but you can’t delete them. You must use another other method to delete components, typically manually.
·         Because change sets are cloud-based, they’re not ideal when used with a source control system.

   Force.com Migration Tool Considerations

·         Requires a more developer-oriented skill set, with experience of Ant and scripting tools
·         Requires storing the username and password on disk, which some security policies don’t permit
Other Deployment Tools and Artifacts

  Besides Change Sets and the Force.com Migration Tool, you can use various tools for deployment. The following table compares some of the tools.
1. We have 3 objects Account, Contact, Opportunity.
   In a VF page, we need to display the names of contact & Opportunity which are related to Account.

    public class accountcontact
02
{

03
    list<AccountWrapper> wraplist=new list<AccountWrapper>();
04
    public accountcontact()

05
    {
06
       Map<Id, AccountWrapper> accMap=new Map<Id, AccountWrapper>();

07
       for(account a:[SELECT CreatedbyID,Account.Name,(SELECT     
08
                name,Contact.FirstName, Contact.LastName

09
                FROM Account.Contacts) FROM Account])
10
       {

11
           AccountWrapper accWrap=accMap.get(a.CreatedByID);
12
           if (null==accWrap)

13
           {
14
              accWrap=new AccountWrapper();

15
              accMap.put(a.CreatedByID, accWrap);
16
              accWrap.userId=a.CreatedById;

17
           }
18


19
           accWrap.accounts.add(a);
20
       }

21

22
       wrapList=accMap.values();

23
   }
24


25
   public list<AccountWrapper> getaccounts()
26
   {

27
      return acclist;
28
   }

29

30
   public class AccountWrapper

31
   {
32
      public Id userId {get; set;}

33
      public List<Account> accounts {get; set;}
34
      public AccountWrapper()

35
      {
36
         accounts=new List<Account>();

37
      }
38
   }

39
      }

    and you can use this in the page like so:


0  1
   < apex:repeat value="{!accounts}" var="accWrap">
02
   <apex:outputText value="User ID : {!accWrap.userId}"/>

03

04
   <apex:repeat value="{!accWrap.accounts}" var="acc">

05
      <apex:outputText value="Account : {!acc.Name}"/>
06


07
      <apex:repeat value="{!acc.contacts}" var="cont">
08
         <apex:outputText value="Contact : {!cont.Name}"/>

09
      </apex:repeat>
10


11
   </apex:repeat>
12


13
</apex:repeat>
 Try pulling back the name of the owner, e.g.


  for(account a:[SELECT CreatedbyID, CreatedBy.Name, Account.Name,(SELECT     
2
             name,Contact.FirstName, Contact.LastName

3
             FROM Account.Contacts) FROM Account])

2. One object (s1) & 3 tasks (t1, t2, t3) are there. Each task performing discount related stuff.   Write a trigger that should calculate the sum of 3 tasks.  And if any task is modified than trigger should fire automatically & perform the same.

(List<Task> listof tasks = [select id, name from Task where whatId=Trigger.new];)
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)

As per your problem , i write a trigger and before this i create a object S1 and in S1 create a currency field sum and in task object create a currency filed discount.
So whenever you create a new task and enter the value in the discount field so its enter the sum field of the S1 record.
Trigger code is :

trigger SumOfDiscount on Task (after insert,after update) {

    set<string> S1IdSet = new set<string>();
    list<S1__c> S1List = new list<S1__c>();
    list<S1__c> updateS1List = new list<S1__c>();

    for(task tsk : trigger.new){
        if(string.valueof(tsk.whatid).substring(0,3) == 'a22'){   // a22 is the intial id of the S1 object
            S1IdSet.add(tsk.whatid);
        }
    }

    S1List = [select id,Sum__c, (select id,whatid,Discount__c from Tasks) from S1__c where id  in:  S1IdSet];

    for(S1__c s1: S1List){
        decimal sum = 0;
        for(task tk : s1.Tasks){
            if(tk.Discount__c != null){
                sum += tk.Discount__c;
                s1.Sum__c = sum;
            }
        }
        updateS1List.add(s1);
    }
    if(updateS1List.size()>0)
        update updateS1List;
}

        What is SOQL & SOSL? What is difference between SOQL & SOSL?
                  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  a   nonymous block.
Can be used in Apex class and Triggers.







4 comments:

  1. Wonderful blog on Cloud domain, Thank you sharing the informative article with us. Hope your article will reach top of the SERP result to the familiar cloud related queries
    Regards:
    Best Institute for Cloud Computing in Chennai
    Salesforce Training in Chennai

    ReplyDelete
  2. Thanks for information , This is very useful for me.
    Keep sharing Lean Six Sigma Green Belt Training Bangalore


    ReplyDelete
  3. Informative post indeed, I’ve being in and out reading posts regularly and I see alot of engaging people sharing things and majority of the shared information is very valuable and so, here’s my fine read.
    click here fa fa icon
    click here get 50 rs
    click here game
    click here gif download
    click here gif png

    ReplyDelete