{"id":1305,"date":"2010-10-12T16:40:39","date_gmt":"2010-10-12T11:10:39","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=1305"},"modified":"2016-02-08T05:56:34","modified_gmt":"2016-02-08T05:56:34","slug":"salesforce-interview-questions-part-3","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions-part-3\/","title":{"rendered":"Salesforce Interview Questions \u2013 Part 3"},"content":{"rendered":"<div class=\"intrinsic-container\"><iframe loading=\"lazy\" src=\"https:\/\/jitendrazaa.com\/blog\/SFDCInterviewList.php?num=3\" width=\"300\" height=\"150\" allowfullscreen=\"allowfullscreen\"> <\/iframe><\/div>\n<p><strong>20. In Which sequence Trigger and automation rules run in Salesforce.com<\/strong><\/p>\n<p><strong>Ans :<\/strong> The following is the order Salesforce logic is applied to a record.<\/p>\n<ol>\n<li>Old record loaded from database (or initialized for new inserts)<\/li>\n<li>New record values overwrite old values<\/li>\n<li>System\u00a0<strong>Validation Rules<\/strong><\/li>\n<li>All Apex &#8220;before&#8221;\u009d triggers<\/li>\n<li>Custom\u00a0<strong>Validation Rules<\/strong><\/li>\n<li>Record saved to database (but not committed)<\/li>\n<li>Record reloaded from database<\/li>\n<li>All Apex &#8220;after&#8221;\u009d triggers<\/li>\n<li><strong>Assignment rules<\/strong><\/li>\n<li><strong>Auto-response rules<\/strong><\/li>\n<li><strong>Workflow rules<\/strong><\/li>\n<li><strong>Escalation rules<\/strong><\/li>\n<li>Parent<strong> Rollup Summary Formula <\/strong>value updated (if present)<\/li>\n<li>Database commit<\/li>\n<li>Post-commit logic (sending email)<\/li>\n<\/ol>\n<p>Additional notes: There is no way to <strong>control the order of execution<\/strong> within\u00a0each group above.<\/p>\n<hr \/>\n<p><strong>21. If one object in Salesforce have 2 triggers which runs &#8220;before insert&#8221;. Is there any way to control the sequence of execution of these triggers?<\/strong><\/p>\n<p><strong>Ans : <\/strong> Salesforce.com has documented that <strong>trigger sequence cannot be predefined<\/strong>. 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.<\/p>\n<hr \/>\n<p><strong>22. How to delete the User from Salesforce?<\/strong><\/p>\n<p><strong>Ans : <\/strong>As per now, salesforce does not allow to delete any user, however you can deactivate the user.<\/p>\n<p><a title=\"Deactivate Users\" href=\"https:\/\/na2.salesforce.com\/help\/doc\/en\/deactivating_users.htm#topic-title\" target=\"_blank\" rel=\"nofollow\">Read further&#8230;<\/a><\/p>\n<hr \/>\n<p><strong>23. How to delete the users data from Salesforce?<\/strong><\/p>\n<p><strong>Ans : <\/strong>To delete the Users Data go to Setup | Administration Setup | Data Management | \u00a0Mass 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.<\/p>\n<hr \/>\n<p><strong>24. How to restrict the user to see any record, lets say opportunity?<\/strong><\/p>\n<p><strong>Ans : <\/strong>set up opportunity sharing to be private. \u00a0If both users are admins or have view all records on opportunity, then that<strong> overrides private sharing<\/strong>.<\/p>\n<hr \/>\n<p><strong>25. What is the difference between trigger.new and trigger.old in Apex &#8211; SFDC?<\/strong><\/p>\n<p><strong>Ans : <\/strong><\/p>\n<p><strong>Trigger.new : <\/strong><\/p>\n<p>Returns a list of the new versions of the sObject records.<\/p>\n<p>Note that this sObject list is only available in insert and update triggers, and the records can only be modified in before triggers.<\/p>\n<p><strong>Trigger.old :<\/strong><\/p>\n<p>Returns a list of the old versions of the sObject records.<\/p>\n<p>Note that this sObject list is only available in update and delete triggers.<\/p>\n<hr \/>\n<p><strong>26. How to restrict any Trigger to fire only once OR how we can avoid repeated or multiple execution of Trigger?<\/strong><\/p>\n<p><strong>Ans: <\/strong><\/p>\n<p>Triggers can fire twice, once before workflows and once after workflows, this is documented at<\/p>\n<p><a href=\"http:\/\/www.salesforce.com\/us\/developer\/docs\/apexcode\/Content\/apex_triggers_order_of_execution.htm\" target=\"_blank\" rel=\"nofollow\">http:\/\/www.salesforce.com\/us\/developer\/docs\/apexcode\/ Content\/ apex_triggers_order_of_execution.htm<\/a>:<\/p>\n<p>&#8220;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.&#8221;<\/p>\n<p><strong>Workaround:<\/strong><\/p>\n<p>Add a static boolean variable to a class, and check its value within the affected triggers.<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npublic class HelperClass {\r\n   public static boolean firstRun = true;\r\n}\r\ntrigger affectedTrigger on Account (before delete, after delete, after undelete) {\r\n    if(Trigger.isBefore){\r\n        if(Trigger.isDelete){\r\n            if(HelperClass.firstRun){\r\n                Trigger.old&#x5B;0].addError('Before Account Delete Error');\r\n                HelperClass.firstRun=false;\r\n            }\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<hr \/>\n<p><strong>27. \u00a0What is difference between WhoId and WhatId in the Data Model of Task ?<\/strong><\/p>\n<p><strong>Ans :<\/strong><\/p>\n<p>WhoID refers to people things. So that would be typically a Lead ID or a Contact ID<br \/>\nWhatID refers to object type things. That would typically be an Account ID or an Opportunity ID<\/p>\n<p><a title=\"Task Data Model\" href=\"http:\/\/www.salesforce.com\/us\/developer\/docs\/api\/Content\/sforce_api_erd_activities.htm\" target=\"_blank\" rel=\"nofollow\">Check Data Model of task here<\/a><\/p>\n<hr \/>\n<p><strong>28. Where is the option of the report for the &#8220;Custom Object with related object&#8221; and what are the condition to generate related reports?<\/strong><br \/>\n<strong> Ans : <\/strong><\/p>\n<p>If the parent object is the standard object provided by the salesforce like &#8220;Account&#8221;, &#8220;Contact&#8221; then the report will be in there section with related custom object.<br \/>\nIf both objects are the custom then the report will be in &#8220;<strong>Other Reports<\/strong>&#8221; Sections.<\/p>\n<p>Following are the conditions to get the report of related objects:<\/p>\n<ul>\n<li>On both the objects, Reports option must be enable.<\/li>\n<li>Both object must be related either using Lookup or Master Detail type of field.<\/li>\n<\/ul>\n<p><a title=\"Custom object with related object report\" href=\"https:\/\/jitendrazaa.com\/blog\/webtech\/salesforce\/where-are-the-reports-for-my-custom-object-with-related-objects-in-salesforce\/\">Read this article, to get detailed idea on this topic.<\/a><\/p>\n<hr \/>\n<p><strong>29. How you can provide the User Login (Authentication) in Public sites created by Salesforce.<\/strong><\/p>\n<p><strong>Answer <\/strong>: We can provide the authentication on public sites using &#8220;Customer Portal&#8221;.<\/p>\n<hr \/>\n<div class=\"intrinsic-container\"><iframe loading=\"lazy\" src=\"https:\/\/jitendrazaa.com\/blog\/SFDCInterviewList.php?num=3\" width=\"300\" height=\"150\" allowfullscreen=\"allowfullscreen\"> <\/iframe><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Most Frequently Asked interview questions of Apex, Visual force, SOQL in Salesforce.com SFDC<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[9],"tags":[337,331,336],"class_list":["post-1305","post","type-post","status-publish","format-standard","hentry","category-salesforce","tag-apex","tag-salesforce","tag-visualforce"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1241,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/step-by-step-salesforce-tutorial-creating-trigger-and-test-cases-6-of-6\/","url_meta":{"origin":1305,"position":0},"title":"Step by Step Salesforce Tutorial \u2013 Creating Trigger and Test cases \u2013 6 of 6","author":"Jitendra","date":"October 11, 2010","format":false,"excerpt":"Step by Step Salesforce Tutorial \u2013 Creating Trigger and test cases \u2013 6 of 6 tutorials series","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Creating Trigger in Salesforce using force.com IDE","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/10\/Creating-Trigger-in-Salesforce-using-force.com-IDE.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2681,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions-part-5\/","url_meta":{"origin":1305,"position":1},"title":"Salesforce Interview Questions &#8211; Part 5","author":"Jitendra","date":"January 24, 2012","format":false,"excerpt":"Basic concepts and Interview Questions of salesforce, Visualforce, Apex and SOQL","rel":"","context":"In &quot;Apex&quot;","block_context":{"text":"Apex","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/apex\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2762,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions-part-6\/","url_meta":{"origin":1305,"position":2},"title":"Salesforce Interview Questions &#8211; Part 6","author":"Jitendra","date":"March 10, 2012","format":false,"excerpt":"Basic concepts and Interview Questions of salesforce, Visualforce, Apex and SOQL","rel":"","context":"In &quot;Apex&quot;","block_context":{"text":"Apex","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/apex\/"},"img":{"alt_text":"Salesforce - External Id option while creating field","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/03\/Salesforce-External-Id-option-while-creating-field.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/03\/Salesforce-External-Id-option-while-creating-field.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/03\/Salesforce-External-Id-option-while-creating-field.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":1038,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions-part-2\/","url_meta":{"origin":1305,"position":3},"title":"Salesforce Interview Questions \u2013 Part 2","author":"Jitendra","date":"September 11, 2010","format":false,"excerpt":"Interview questions of salesforce.com, interview questions of visualforce.com and APEX","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Account Child relationship in salesforce","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/09\/Account-Child-relationship-in-salesforce.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":28,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions\/","url_meta":{"origin":1305,"position":4},"title":"Salesforce Interview Questions &#8211; Part 1","author":"Jitendra","date":"May 6, 2010","format":false,"excerpt":"Set of most often asked questions on the salesforce.com developement","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2835,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-apex-code-talk-important-questions-and-answers\/","url_meta":{"origin":1305,"position":5},"title":"Salesforce Apex Code talk &#8211; Important Questions and Answers","author":"Jitendra","date":"May 3, 2012","format":false,"excerpt":"Salesforce Apex Code talk on - 24-April-2012 , Important Interview Questions","rel":"","context":"In &quot;Apex&quot;","block_context":{"text":"Apex","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/apex\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/1305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=1305"}],"version-history":[{"count":8,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/1305\/revisions"}],"predecessor-version":[{"id":5283,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/1305\/revisions\/5283"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=1305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=1305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=1305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}