Browsing "Older Posts"

  • cognizant-CTS salesforce Interview Questions for Experienced & Freshers

    salesforcepoint Monday, 27 February 2017
    cognizant-CTS salesforce Interview Questions
    1.Tell me about What is crm life-cycle?
    2.What is lead conversion process and how its helpful in CRM?.
    3.What is SDLC? which methodology you are using?
    4.What is profile and explain profile components in salesforce?
    5. permission sets and explain its uses?
    6.difference between salesforce profile and permission sets
    7.What is workflow rules and briefly explain it? Difference between evaluation criteria created, and every time it’s edited and created & and any time it’s edited to subsequently meet the criteria?
    8.approval process in salesforce and give me one use case?
    9.What is report type?
    10 .Which reports support dashboards
    11 .What are sharing settings in salesforce? 
    12. Difference between summary and matrix report in salesforce?
    13. process builder& need of process builder?
    14.What are escalation rules and briefly explain
    15 .What is soap web service and briefly expalin how you know about that(It depends if you put in resume)
    16. How you can rate yourself in salesforce?
    17. What type of settings you can give in permission sets
    18.What are the technologies available in cloud computing other than salesforce
    19.Why salesforce is more popular?
    20. Difference Between Lookup & Master Detail Relationship in salesforce?
    21.what is web to Lead functionality in salesforce?
    22.What is email to case & web to case in salesforce?
  • Create trigger to assign lead owners based on web domain

    salesforcepoint Sunday, 26 February 2017
    Object   : Lead
    Evernt : before Insert
    Requirement : When ever new Lead is created with lead source as Web  then assign Venkatesh as owner

    Trigger :
    trigger OwnerAssign on Lead (before insert) {
    User u=[select id from user where username='Venkatesh@dev.com'];
        for(Lead my:Trigger.new){
            if(my.leadsource=='Web'){
                my.ownerId=u.Id;
            }
        }
    }



    Test Class :
    @isTest
    private class OwnerAssignTest {
    @isTest
        static void testme(){
            Lead my=new Lead();
            my.LastName='Ram';
            my.company='Salesforce';
            my.AnnualRevenue=8000;
            my.LeadSource='Web';
            insert my;
            User u=[select id from User where username='venkatesh@dev.com'];
            Lead l=[select ownerId from Lead where id=:my.Id];
            if(my.leadSource=='Web'){
            System.assertEquals(l.ownerId,u.Id);
            }
        }
    }
  • Accenture Salesforce Interview Questions

    salesforcepoint Saturday, 25 February 2017

    Accenture- Salesforce Interview Questions(Admin, Development, apex, Trigger, Visualforce Pages)



    1. write a trigger on Account, While inserting a text value as 'someName' ended with 'text' ex: 'renuText' On Account Object it should through an error. How you will achieve this...??
    2. How you will write the Validation rule for the above scenario while inserting the record and the Validation rule should not fire while updating form workflow it shows be accept.
    3. In one of the objects there are two fields called Field1 and Filed2 exist and we have 100,000 records, out of 70,000 record values are equal in field1 and field2. Now Display those 70,000 records on visualforce page.
    4. In an Account Object a field called ‘Sales Person‘ and it has a lookup relation with the user object.
    If a user is selected as a salesperson for a record, that user is able to see those records, but OWD is private, the record owner and admin will not share any records.

    5. Soap & REST Differences and in which format these are used to send and receive.
    6. How you will get the Consumer Key and Consumer secrete.
    7. How to get the external ID from another system and update it in the Salesforce ExternalID field, if you get null value from other systems how you will through an error.
    8. How you will call other services
    9. Why do we use @future annotation?
    10. What is an asynchronous process and why it is needed?
    11. What is the purpose of using with sharing and without sharing?
  • When To Use Before Triggers & After Triggers in Salesforce

    salesforcepoint Wednesday, 22 February 2017
    Difference Between Before Trigger and After Trigger & When Should we use Before & After Triggers:

    Before Triggers: Before triggers are used to update or validate record values before they’re saved to the database.

    Uses:

    1. When we need to write validation on same object record.
    2. Insert and update operation same object.

    Sample Example: if opportunity amount is less then 10000 then through error.


    Trigger validateOppRecord on opportunity(Before Insert){
                             For(opportunity o: Trigger.new)
                               If(o.amount<10000){
                                   o.addError(‘please Enter opportunity amount more than 5000’);
                                  }

                            }

    After Triggers: 
    After Trigger:  After trigger is used when we perform DML operation on one object record and action will effect on another object record by accessing system fields such as record id and last mododifieddate field .

    USES: Insert/Update on related object, not the same object.
                 Notification email.


    Note: We cannot use After trigger if we want to update same record because after saving, record will be committed to database and record will be locked. The records, which fired with after trigger are read only. so  it causes read only error(System.FinalException: Record is read-only) if we perform operation on same object.

    Sample Example: Automatically create a Contact record when we create new Account Record.

    Trigger autoaccCon on Accout(After Insert){
        List<Contact> conlist = new List<Contact>();
        For(Account acc:Trigger.New){
           Contact con = New Contact();
           con.accountid=acc.id;
           con.lastname = acc.name;
           conlist.add(con);
        }
        insert conlist;
    }

  • Difference Between Trigger.New and Trigger.old with Example

    salesforcepoint Monday, 20 February 2017
    Trigger.new and Trigger.old both are context variables in Salesforce. 

    Trigger.New: Trigger.new returns List of new records which are trying to insert/update into Database. This is available in Before Insert, Before Update, After Insert,  After Update Triggers and undelete Triggers. This list of records can only modified in Before triggers.

    Trigger.Old: Trigger.old returns List of old records which are updated with new values. These List of records already there in Database. Trigger.old available in Before update, after update, Before Delete and After Delete triggers.


    Before Insert Trigger
    -----------------------
    Trigger.new- What are the records going to insert into Database [not commited yet, id=null]
    trigger.old- NULL
    Trigger.newmap-null
    Trigger.old-Null


    Afeter Insert
    -----------------------------
    Trigger.new- New List of Records which are  inserted
    Trigger.old- null
    Trigger.NewMap- New Map<ID, new Record>
    Trigger.oldMap- Null


    Before Update
    ------------------------------
    Trigger.new- New List of Records which are going to be updated
    Trigger.old- List of  Records with old values.
    Trigger.NewMap- New Map<ID, new Record>
    Trigger.oldMap- Old Map<ID, old record>


    After Update
    -------------------------------
    Trigger.new- New List of Records which are  updated
    Trigger.old- List of  Records with old values.
    Trigger.NewMap- New Map<ID, new Record>
    Trigger.oldMap- Old Map<ID, old record>

    Example: I have a scenario like when Account Phone number is updated then Account Description value should be updated with old phone number+new phone number.

    trigger NewVsOld on Account (before update) {
        for(integer i=0; i<trigger.new.size();i++){
    /*if Old Phone number and New phone number are not same then Description field will be updated with Old phone number+New phone number. if same no change will be in Description field*/
        if(trigger.old[i].phone!=trigger.new[i].phone){
            trigger.new[i].description='old phone number is  ' + trigger.old[i].phone + ' and New Phone number is ' +trigger.new[i].phone ;
       }
     }
    } 



    Here i have created one new Account record with phone number 7799703404
    I have updated phone number 7799703404 with new phone number 8897125248 and saved the record. Then description field automatically updated with "old phone number is  (779) 970-3404 and New Phone number is (889) 712-5248".


    In above Example Trigger.new record holds new phone number 887125248 and Trigger.old holds old phone number 7799703404.
  • Trigger Execution Process in Salesforce| Order Of Trigger Execution

    salesforcepoint Thursday, 9 February 2017

    1) Loads the  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 with new values.

    If the request came from a standard User Interface edit page,  runs system validation to check the record for:
      -Checks whether Required values is present or not at the page layout level and field-definition level
      -checks field formats are valid or not (example:  Email ID format, Phone number format)
    3) All before triggers execution.
    4) Runs most system validation steps again, such as verifying that all required fields have a non-null value, and then runs any custom 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 to Database.
    6) all after triggers Executed.

    7) Run assignment rules and auto-response rules.
    8) workflow rules Executed.
    9) If there is any workflow field update, updates the record again.
    10) If the record  updated with workflow field update, 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.
    11) escalation rules executed.
    12) If the record contains a roll-up summary field, rollup summary fields are calculated and updated.
    13) Run Criteria Based Sharing evaluation.
    14) Commits all DML operations to the database.
    15) Run post-commit logic, such as sending email.
  • Salesforce Apex Triggers Best Practices

    salesforcepoint
    Salesforce Apex Triggers Best Practices

    Important Salesforce Apex Triggers Best Practices

    1) Write One Trigger per one Object
    You can have n number of triggers on single object, but as apex best practice we should write  logic in handler class. If you write multiple Triggers on single object, we cant control order of execution .


    2) Always write Logic-less Triggers
    Always write logic in apex handler or helper class so that we can reuse it. Create context-specific handler methods in trigger handler class.

    3) Always Bulkify your Code
    your code must work on more than one record at a time.
    Bulkifying Apex code means  we make sure the code properly handles more than one record at a time. The trigger code must be process on multiple  records instead of single record for avoid hitting governor limits.


    4) Always Avoid SOQL Queries and DML statements inside FOR Loops
    This is one of the salesforce apex best practices. Since apex is running under Multi-tenant architecture it strictly enforces some governor limits to control wastage of resource utilization. if we use soql inside for loop, that may causes to hit governor Limits.


    If we write  SOQL query inside for loop that iterates across all object records. Soql query will be executed for each record. An individual Apex request works 100 SOQL queries before exceeding that governor limit. So if the trigger is invoked by a batch of more than 100 records, the governor limit will throw a runtime exception.

    Total number of SOQL queries issued for a single Apex transaction- 100
    Total number of DML statements issued-150


    5) Using Collections, Streamlining Queries, and Efficient For Loops to avoid governors.
    It is important to use Apex Collections(LIST, SET,MAP)  to efficiently query data and store the data in memory. As a good developer you should learn effective usage of Map.



    6)Avoid to Query Large Data Sets
    The total number of records that can be returned by SOQL queries in a request is 50,000. If returning a large set of queries causes you to exceed your heap limit, then Use SOQL  with proper filter conditions(Where conditions) , to avoid 50001 limit error.

    7) Use @future Appropriately
    @Future is used to run processes in a separate thread, at a later time when system resources become available. @Future have Future methods that will runs asynchronously.

    8) Avoid Hard-coding IDs
    Don't hard code IDs into queries or apex code. Rather query on some other data to retrieve the desired rows. Record Id's can change across org's.

    9) Handle recursion
    As triggers gets invoked automatically when dml occurs, there could be scenarios where same trigger logic gets called multiple times. This may cause unnecessary resource consumption (Query, cpu time, dml). So we need to handle such code of scenarios effectively.