Salesforce Interview Questions – Part 3

Get articles everyday as a email directly to your inbox:
Click to publicize, if you like this article :


20. 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.


21. 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?

Ans : 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.


22. How to delete the User from Salesforce?

Ans : As per now, salesforce does not allow to delete any user, however you can deactivate the user.

Read further…


23. How to delete the users data from Salesforce?

Ans : 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.


24. How to restrict the user to see any record, lets say opportunity?

Ans : set up opportunity sharing to be private.  If both users are admins or have view all records on opportunity, then that overrides private sharing.


25. What is the difference between trigger.new and trigger.old in Apex – SFDC?

Ans :

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, and 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.


26. How to restrict any Trigger to fire only once ?

Ans:

Triggers can fire twice, once before workflows and once after workflows, this is documented at

http://www.salesforce.com/us/developer/docs/apexcode/ Content/ apex_triggers_order_of_execution.htm:

“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:

Add a static boolean variable to a class, and check its value within the affected triggers.

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;
            }
        }
    }
}

27.  What is difference between WhoId and WhatId in the Data Model of Task ?

Ans :

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

Check Data Model of task here


28. Where is the option of the report for the “Custom Object with related object” and what are the condition to generate related reports?
Ans :

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 enable.
  • The relationship between both of them must be “Master – detail relationship”.

Read this article, to get detailed idea on this topic.


29. How you can provide the User Login (Authentication) in Public sites created by Salesforce.

Answer : We can provide the authentication on public sites using “Customer Portal”.


You can leave a response, or trackback from your own site.
  • Pingback: Latest Salesforce Interview Questions - Part 6 | Shiva Blog

  • Mohammed Towfeeq

    what is the difference between running user and logged in user 

    • JitendraZaa

      Hi Towfeeq,
      In most of the cases logged in user will be same as running user.
      However, there are scenario like logged in user does not have permission to see some dashboard or report in that case we can set the running user so that logged in user can have access to those data.
      I hope it clears your doubt.

  • XYZ

    Nice …:-)

  • ANNONNY

    Where is the view Account hierarchy link?

    • http://shivasoft.in Jitendra Zaa

      Hi Annomny,
      “View Account hierarchy” link is visible next to account name.
      Example -
      Account Name abc [View Hierarchy]

      Regards,
      Jitendra Zaa

  • ravi

    it is super

  • vaithee

    when to expect part 5

    • http://shivasoft.in Jitendra Zaa

      It would be published soon.

      Regards,
      Jitendra Zaa

  • Pingback: Very useful tips and tricks of the Apex - Salesforce Interview Questions Part 4 | Shiva Blog

  • Balaji

    Thanks very much..keep going..

  • Amit

    Excellent Work buddy

  • Thiresh

    hi iam tiresh reddy working on salesforce..i was please with your blog which was posted by u..thanks for that..plz accept my add request n plz do send any updates on salesforce along with some interview questions..

  • matiman

    Great interview questions.

    I was self-studying how to develop on Force.com platform. My intention is to work on Force.com platform as a cloud developer. I had 3 years of experience in developing web apps in Java. Do you think there will positions available in the market for the guys like who has no professional experience in developing Salesforce.com’s appliation?

    Thank you and I appreciate your help.

  • bhaskar

    can any one send “what exactly Customization is???”

  • ravi

    Its nice Blog…Plz can anybody send more admin interview questions as soon as possible…….

  • hemanth

    Thankx a million jitendra! \m/

  • hemanth

    Hello Jitendra,
    i learning salesforce aiming for a developer position, can you please send me any links to learn apex, will be looking forward to hear from you.

  • Pingback: Prevent an Apex Trigger from executing twice | Cloud Clod

  • Ranjit

    Hiiiii
    This one nice site. Keep going.
    Have a nice day.

  • Interview Advice

    Hello.
    That nice site. Keep going.
    Have a nice day.