{"id":2681,"date":"2012-01-24T01:05:58","date_gmt":"2012-01-23T19:35:58","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=2681"},"modified":"2015-02-09T01:29:13","modified_gmt":"2015-02-09T01:29:13","slug":"salesforce-interview-questions-part-5","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions-part-5\/","title":{"rendered":"Salesforce Interview Questions &#8211; Part 5"},"content":{"rendered":"<div class=\"intrinsic-container\"><iframe loading=\"lazy\" src=\"https:\/\/jitendrazaa.com\/blog\/SFDCInterviewList.php?num=5\" width=\"300\" height=\"150\" allowfullscreen=\"allowfullscreen\"> <\/iframe><\/div>\n<p><strong>40. What is Master Detail relationship and look up relationship in Salesforce?<\/strong><br \/>\n<strong> Ans:<\/strong><br \/>\nMaster Detail relationship is the<strong> Parent child relationship<\/strong>. In which Master represents Parent and detail represents Child. If Parent is deleted then Child also gets deleted. Rollup summary fields can only be created on Master records which will calculate the SUM, AVG, MIN of the Child records.<br \/>\nLook up relationship is something like <strong>&#8220;has-a&#8221; (Containership) relationship<\/strong>. Where one record has reference to other records. When one record is deleted then there is no impact on other records.<\/p>\n<hr \/>\n<p><strong>41. Can we convert the lookup relationship to Master Detail relationship?<\/strong><br \/>\n<strong> Ans:<\/strong><br \/>\nWe can convert the lookup relationship to master detail relationship if and only if all the existing record has valid lookup field.<\/p>\n<hr \/>\n<p><strong>42. In How many way we can invoke the Apex class?<\/strong><br \/>\n<strong> Ans:<\/strong><\/p>\n<ol>\n<li>Visualforce page<\/li>\n<li>Trigger<\/li>\n<li>Web Services<\/li>\n<li><a title=\"Email Services\" href=\"https:\/\/jitendrazaa.com\/blog\/salesforce\/email-services-in-salesforce-with-simple-example\/\" target=\"_blank\">Email Services<\/a><\/li>\n<\/ol>\n<hr \/>\n<p><strong><!--more-->43. Can we create Master Detail relationship on existing records?<\/strong><br \/>\n<strong> Ans:<\/strong><br \/>\nNo. As discussed above, first we have to create the lookup relationship then populate the value on all existing record and then convert it.<\/p>\n<hr \/>\n<p><strong>44. How validation rules executed? is it page layout \/ Visualforce dependent?<\/strong><br \/>\n<strong> Ans :<\/strong><br \/>\nThe validation rules run at the data model level, so they are not affected by the UI. Any record that is saved in Salesforce will run through the validation rules.<\/p>\n<hr \/>\n<p><strong>45. What is the difference between database.insert and insert ?<\/strong><br \/>\n<strong> Ans:<\/strong><br \/>\n<strong>insert<\/strong> is the DML statement which is same as <strong>databse.insert<\/strong>. However, database.insert gives more flexibility like rollback, default assignment rules etc. we can achieve the database.insert behavior in insert by using the method setOptions(Database.DMLOptions)<br \/>\n<strong>Important Difference:<\/strong><\/p>\n<ul>\n<li>If we use the DML statement (insert), then in bulk operation if error occurs, the execution will stop and Apex code throws an error which can be handled in try catch block.<\/li>\n<li>If DML database methods (Database.insert) used, then if error occurs the remaining records will be inserted \/ updated means partial DML operation will be done.<\/li>\n<\/ul>\n<hr \/>\n<p><strong>46. What is the scope of static variable ?<\/strong><br \/>\n<strong> Ans:<\/strong><br \/>\nWhen you declare a method or variable as static, it&#8217;s initialized only once when a class is loaded. Static variables aren&#8217;t transmitted as part of the view state for a Visualforce page.<\/p>\n<p>Static variables are only static within the scope of the request. They are not static across the server, or across the entire organization.<\/p>\n<hr \/>\n<p><strong>47. Other than SOQL and SOSL what is other way to get custom settings?<\/strong><br \/>\n<strong> Ans:<\/strong><br \/>\nOther than SOQL or SOSL, Custom seting have there own set of methods to access the record.<br \/>\nFor example : if there is custom setting of name ISO_Country,<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nSO_Country__c code = ISO_Country__c.getInstance(&quot;\u02dcINDIA');\r\n\/\/To return a map of data sets defined for the custom object (all records in the custom object), \/\/you would use:\r\nMap&lt;String,ISO_Country__c&gt; mapCodes = ISO_Country__c.getAll();\r\n\/\/ display the ISO code for India\r\nSystem.debug(&quot;\u02dcISO Code: &quot;\u02dc+mapCodes.get(&quot;\u02dcINDIA').ISO_Code__c);\r\n\/\/Alternatively you can return the map as a list:\r\nList&lt;String&gt; listCodes = ISO_Country__c.getAll().values();\r\n<\/pre>\n<hr \/>\n<p><strong>48. What happen if child have two master records and one is deleted?<\/strong><br \/>\n<strong> Ans :<\/strong><br \/>\nChild record will be deleted.<\/p>\n<p><a title=\"More than one master record\" href=\"https:\/\/jitendrazaa.com\/blog\/webtech\/salesforce\/deep-drive-in-junction-object-create-many-to-many-relationship-in-salesforce\/\" target=\"_blank\">read more in this article.<\/a><\/p>\n<hr \/>\n<p><strong>49. What is Difference in render, rerender and renderas attributes of visualforce?<\/strong><br \/>\n<strong> Ans:<\/strong><br \/>\n<strong>render<\/strong> &#8211; It works like &#8220;display&#8221; property of CSS. Used to show or hide element.<br \/>\n<strong>rerender<\/strong> &#8211; After Ajax which component should be refreshed &#8211; available on commandlink, commandbutton, actionsupport etc.<br \/>\n<strong>renderas<\/strong> &#8211; render page as pdf, doc and excel.<\/p>\n<hr \/>\n<p><strong>50. What is Scheduler class in Apex and explain how to use Crone statement to Schedule Apex class?<\/strong><br \/>\n<strong> Ans:<\/strong><br \/>\nThe Apex class which is programed to run at pre defined interval.<br \/>\nClass must implement <strong>schedulable<\/strong> interface and it contains method named execute().<br \/>\nThere are two ways to invoke schedular :<\/p>\n<ol>\n<li>Using UI<\/li>\n<li>Using System.schedule<\/li>\n<\/ol>\n<p>The class which implements interface schedulable get the button texted with &#8220;Schedule&#8221;\u009d, when user clicks on that button, new interface opens to schedule the classes which implements that interface.<br \/>\nTo see what happened to scheduled job, go to &#8220;<strong>Monitoring | Scheduled jobs<\/strong> &#8221;<\/p>\n<p>Example of scheduling :<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nscheduledMerge m = new scheduledMerge();\r\nString sch = '20 30 8 10 2 ?';\r\nsystem.schedule('Merge Job', sch, m);\r\n<\/pre>\n<p>To see how to make crone job string &#8211; R<a title=\"Crone Job String Maker\" href=\"http:\/\/www.cronmaker.com\/\" target=\"_blank\">efer this Online Crone Expression Generator tool<\/a>\u00a0.<\/p>\n<blockquote><p><strong>Note :<\/strong> Salesforce only accepts integer in Seconds and Minutes. So, lets say if you want to run Apex job on every 10 minutes, crone statement will be &#8216;0 0\/10 * 1\/1 * ? *&#8217; and salesforce will throw an error saying &#8220;<strong>System.StringException: Seconds and minutes must be specified as integers<\/strong>&#8220;. That mean like Time based Workflow, minimum interval to schedule job is <strong>1 hour<\/strong>.<\/p><\/blockquote>\n<hr \/>\n<div class=\"intrinsic-container\"><iframe loading=\"lazy\" src=\"https:\/\/jitendrazaa.com\/blog\/SFDCInterviewList.php?num=5\" width=\"300\" height=\"150\" allowfullscreen=\"allowfullscreen\"> <\/iframe><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Basic concepts and Interview Questions of salesforce, Visualforce, Apex and SOQL<\/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_post_was_ever_published":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":""},"categories":[20,24,9,18],"tags":[331],"class_list":["post-2681","post","type-post","status-publish","format-standard","hentry","category-apex","category-force-com","category-salesforce","category-visualforce","tag-salesforce"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1032,"url":"https:\/\/www.jitendrazaa.com\/blog\/others\/tips\/difference-in-master-detail-relationship-and-look-up-relationship-salesforce-interview-question\/","url_meta":{"origin":2681,"position":0},"title":"Difference in Master-Detail relationship and look up relationship &#8211; Salesforce Interview question","author":"Jitendra","date":"September 11, 2010","format":false,"excerpt":"Difference in Master-Detail relationship and look up relationship - Salesforce Interview question","rel":"","context":"In &quot;Tech Tips&quot;","block_context":{"text":"Tech Tips","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/others\/tips\/"},"img":{"alt_text":"Master detail and look up relationship Salesforce","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/09\/Master-detail-and-look-up-relationship-Salesforce.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2473,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/deep-drive-in-junction-object-create-many-to-many-relationship-in-salesforce\/","url_meta":{"origin":2681,"position":1},"title":"Deep  dive into Junction object &#8211; Create many to many relationship in Salesforce","author":"Jitendra","date":"October 20, 2011","format":false,"excerpt":"Article to show step by step process of creating junction object for Many to Many relationship in salesforce and impact of deleting one master record on others","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Creating Custom object in salesforce","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/10\/Creating-Custom-object-in-salesforce.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3218,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-question-part-15\/","url_meta":{"origin":2681,"position":2},"title":"Salesforce Interview Question \u2013 Part 15","author":"Jitendra","date":"May 24, 2013","format":false,"excerpt":"141 : User Wants to set the starting day in Calendar as \"Monday\" instead of \"Sunday\". How to get it done? Ans : Change the user locale to \"English ( United Kingdom ) \" in Personal information or User record. 142 : Why CSS is not working in PDF created\u2026","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":2825,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions-part-7\/","url_meta":{"origin":2681,"position":3},"title":"Salesforce Interview Questions &#8211; Part 7","author":"Jitendra","date":"April 23, 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":1038,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions-part-2\/","url_meta":{"origin":2681,"position":4},"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":3855,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/large-data-volumes-ldv-in-salesforce\/","url_meta":{"origin":2681,"position":5},"title":"Large Data Volumes (LDV) in Salesforce | FAQs | Interview Questions","author":"Jitendra","date":"April 18, 2014","format":false,"excerpt":"You would like to go through this useful cheat sheet for \"Query and Search\" optimization, few of this is discussed in this post as FAQ. 171 : How Standard Fields and Custom Fields related information is saved inside Salesforce Database? Is every Standard and Custom Object is created as a\u2026","rel":"","context":"In &quot;Configuration&quot;","block_context":{"text":"Configuration","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/configuration\/"},"img":{"alt_text":"Skinny Table","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2014\/04\/Skinny-Table.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2681","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=2681"}],"version-history":[{"count":6,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2681\/revisions"}],"predecessor-version":[{"id":4219,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2681\/revisions\/4219"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=2681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=2681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=2681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}