Salesforce Interview Questions – Part 3

20. In Which sequence Trigger and automation rules run in Salesforce.com

Ans : 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
  5. Custom Validation Rules
  6. Record saved to database (but not committed)
  7. Record reloaded from database
  8. All Apex “after” triggers
  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 OR how we can avoid repeated or multiple execution of Trigger?

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.
  • Both object must be related either using Lookup or Master Detail type of field.

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


Posted

in

by


Related Posts

Comments

30 responses to “Salesforce Interview Questions – Part 3”

  1. Interview Advice Avatar
    Interview Advice

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

  2. Ranjit Avatar
    Ranjit

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

  3. […] worked. Solution from Jitendra Zaa This entry was tagged apex, salesforce, trigger. Bookmark the permalink. ← Attending […]

  4. hemanth Avatar
    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.

    1. Jitendra Zaa Avatar

      Hey Hemanth,
      Follow below URL:
      http://www.salesforce.com/services-training/training_certification/certification/certification-faq.jsp#signup

      Here, you will get links for the certification preparation which will help you to learn the Salesforce.
      Watch the podcast videos provided on link and also see the tutorial of salesforce which I have added to lean salesforce step by step.
      For any further detail, Contact me.

  5. hemanth Avatar
    hemanth

    Thankx a million jitendra! m/

  6. ravi Avatar
    ravi

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

  7. bhaskar Avatar
    bhaskar

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

  8. matiman Avatar
    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.

  9. Thiresh Avatar
    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..

  10. Amit Avatar
    Amit

    Excellent Work buddy

  11. Balaji Avatar
    Balaji

    Thanks very much..keep going..

  12. vaithee Avatar
    vaithee

    when to expect part 5

    1. Jitendra Zaa Avatar

      It would be published soon.

      Regards,
      Jitendra Zaa

  13. ravi Avatar
    ravi

    it is super

  14. ANNONNY Avatar
    ANNONNY

    Where is the view Account hierarchy link?

    1. Jitendra Zaa Avatar

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

      Regards,
      Jitendra Zaa

  15. XYZ Avatar
    XYZ

    Nice …:-)

  16. Mohammed Towfeeq Avatar
    Mohammed Towfeeq

    what is the difference between running user and logged in user 

    1. JitendraZaa Avatar
      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.

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

    1. JitendraZaa Avatar
      JitendraZaa

      Thanks Abhi,

      URL provided by you says – If the request came from a standard UI edit page, Salesforce runs system validation to check the record for :

      So, above sequence is still there.

  18. Praveen Avatar
    Praveen

    Nice job Jitendra. Thank you so much for sharing your knowledge. Hope this is not late to appreciate your good work.
    Reg, Q.No 28: You mentioned that, Condition to create reports between two objects is, should be master detail relations ship. But I have created look up relation. Still I am able to see reports for both objects (in Other Reports ). But I have observed a difference. i.e.

    Ex: Obj names: Master and Child

    Master-Details relation ship: Master with Child

    Look up relation: Child with Master.

    My question is. is this new feature given by Salesforce or was already there.

    1. JitendraZaa Avatar
      JitendraZaa

      Thanks Praveen, I have corrected answer.

  19. Jaya Koti Avatar
    Jaya Koti

    Hi Jitendra..
    In OOE for point no: 4 & 8, you mentioned like EE & UE only, Does this mean the Apex triggers executes only in the EE & UE ??

    1. Jitendra Zaa Avatar

      Thats not true now, this post was written around 5 years back. I have updated it to reflect correct answer.

  20. Pratyush Kumar Avatar
    Pratyush Kumar

    Sir,
    Your blog is very useful, it contains detailed and precise information.
    Regards
    Pratyush

  21. Praneeth Avatar
    Praneeth

    Hi Jitendra,
    I have learnt salesforce classic and can you please guide to get hands on experience on this.
    Do i need to learn salesforce lightning to crack the interviews in the current situauion as no one is expecting salesforce classic now. Can you please guide me on this.

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