{"id":3773,"date":"2014-12-16T21:28:55","date_gmt":"2014-12-16T21:28:55","guid":{"rendered":"http:\/\/www.jitendrazaa.com\/blog\/?p=3773"},"modified":"2015-10-08T04:41:43","modified_gmt":"2015-10-08T04:41:43","slug":"salesforce-faq-part-19","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-faq-part-19\/","title":{"rendered":"Salesforce interview questions &#8211; Part 19"},"content":{"rendered":"<div class=\"intrinsic-container\"><iframe loading=\"lazy\" src=\"https:\/\/jitendrazaa.com\/blog\/SFDCInterviewList.php?num=19\" width=\"300\" height=\"150\" allowfullscreen=\"allowfullscreen\"> <\/iframe><\/div>\n<p><strong>181. Lets consider your custom Object named &#8220;Training__c&#8221; has field &#8220;Trainer__c&#8221;. You have set some default value in that field. Will that default value apply to new record created by apex code ?<\/strong><br \/>\n<strong>OR<\/strong><br \/>\n<strong>How to make sure that record created from apex code should respect default value of fields ?<\/strong><br \/>\n<strong>OR<\/strong><br \/>\n<strong>Default value in field from Apex code.<\/strong><br \/>\n<strong>Ans :<\/strong><\/p>\n<p>After API 20, it should automatically populate However there is <a title=\"Field\u2019s default value is ignored in postback requests\" href=\"https:\/\/success.salesforce.com\/issues_view?id=a1p30000000T2rAAAS\">known issue<\/a> for same here, click here if it impacts you.<br \/>\n<span style=\"text-decoration: underline;\">Workaround :<\/span><br \/>\nIf Default value of field is not getting populated by Apex then we have to use &#8220;Dynamic Apex&#8221;. \u00a0Create instance of object from sObjectType like shown below:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nTraining__c tr= (Training__c) Training__c.sObjectType.newSObject(null, true);\r\n\r\n\/\/Check if Value in field &quot;Trainer__c&quot; is default value\r\nSystem.assertEquals('Jitendra', tr.Trainer__c);\r\n<\/pre>\n<hr \/>\n<p style=\"text-align: justify;\"><strong>182. What is best practice to refer dynamic custom messages in Visualforce with multi-language support ?<\/strong><br \/>\n<strong> Ans :<\/strong><br \/>\nUsing Custom Label or OutputField or InputField tag, Platform itself will take care of internationalization. However in some cases, Message needs to be dynamic at the same time it should also support muti-language.\u00a0In Custom Label, we cannot save dynamic String.<\/p>\n<p style=\"text-align: justify;\">Let&#8217;s assume we want to show message something like &#8220;DEVELOPERNAME is not authorized to access this page&#8221;.<br \/>\nHere, Developername should be dynamically changed in visualforce which supports\u00a0multilanguage. For each developername, it is not feasible to create custom labels. So below workaround can be used :<\/p>\n<p style=\"text-align: justify;\"><strong>Step 1 :<\/strong> Create a Custom Label with text &#8220;<em>{0} is not authorized to access this page<\/em>&#8220;. In every language, dynamic value should represented by {0}.<\/p>\n<p><strong>Step 2 :<\/strong> In Controller of Visualforce write something like this :<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nString developerName = 'Some DeveloperName';\r\nString message = String.format(Label.DEVELOPERNA, new String&#x5B;] { developerName });\r\n<\/pre>\n<p><!--more--><\/p>\n<hr \/>\n<p><strong>183. How can you update Salesforce record using Apex, when you don&#8217;t know Object API name, but you know record Id ?<\/strong><br \/>\n<strong> Ans :<\/strong><br \/>\nUsing Dynamic Apex we can achieve this :<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\/\/Lets assume this is record Id\r\nId recId = 'a0P9000000ESXcV';\r\n\r\nSchema.SObjectType token = recId.getSObjectType();\r\nSobject s = token.newSobject();\r\ns.put('Id',recId );\r\ns.put('Name', 'om');\r\nupdate s;\r\n<\/pre>\n<hr \/>\n<p><strong>184. How to disable Header ribbon in Salesforce Organization where\u00a0Community is enabled ?<\/strong><br \/>\n<strong>Ans :<\/strong> In Profile &#8220;View Global Header&#8221; controlls visibility of B lack ribbon whioch is used to switch between community.<\/p>\n<hr \/>\n<p><strong>185. How many record can be displayed in repeater or PageBlockTable in Visualforce ?<\/strong><br \/>\n<strong>Ans :<\/strong> current limit is 1000 records.<\/p>\n<hr \/>\n<p><strong>186. How to display more than 1000 records in repeater or PageBlockTable component of Visualforce ?<\/strong><br \/>\n<strong>Ans :<\/strong> If circumstances permits, we can use readOnly attribute available at apex page level. <a title=\"Setting Read-Only Mode for an Entire Page\" href=\"https:\/\/www.salesforce.com\/us\/developer\/docs\/pages\/Content\/pages_controller_readonly_context_pagelevel.htm\">Read more about making complete page readonly.<\/a><\/p>\n<hr \/>\n<p><strong>187. How we can check API limits already used in any organization by using REST or SOAP API ?<\/strong><br \/>\n<strong> Ans :<\/strong><br \/>\n<a title=\"Salesforce SOAP API header information\" href=\"http:\/\/www.salesforce.com\/developer\/docs\/api\/Content\/sforce_api_header_limitinfo.htm\" rel=\"nofollow\">SOAP API<\/a> and <a title=\"Salesforce REST API Header Information\" href=\"https:\/\/www.salesforce.com\/us\/developer\/docs\/api_rest\/Content\/headers_api_usage.htm\" rel=\"nofollow\">REST API <\/a>always returns header after making successful call\u00a0to Salesforce.<\/p>\n<p>Sample Responses:<\/p>\n<p><span style=\"text-decoration: underline;\">SOAP :<\/span><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;soapenv:Header&gt;\r\n    &lt;LimitInfoHeader&gt;\r\n        &lt;limitInfo&gt;\r\n            &lt;current&gt;45&lt;\/current&gt;\r\n            &lt;limit&gt;5000&lt;\/limit&gt;\r\n            &lt;type&gt;API REQUESTS&lt;\/type&gt;\r\n        &lt;\/limitInfo&gt;\r\n    &lt;\/LimitInfoHeader&gt;\r\n&lt;\/soapenv:Header&gt;\r\n<\/pre>\n<p><span style=\"text-decoration: underline;\">REST :<\/span><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nSforce-Limit-Info: api-usage=45\/5000\r\n<\/pre>\n<hr \/>\n<p style=\"text-align: justify;\"><strong>188. Lets say you have written trigger on Opportynity and want to access field of Account. Can you use this Syntax &#8211; oppObj.Account.someField__c ?<br \/>\nAns :<\/strong> There is common missunderstanding that what is allowed in Trigger Context. Above Syntax will work on any other places like Visualforce Controller. However in Trigger, Lookup field or related list is not available implicitly, we need to query it.<\/p>\n<hr \/>\n<p><strong>189. How we can control Chatter email settings while creating or updating users using Data Loader?<br \/>\nAns : <\/strong>Using a dataloader update the user object&#8217;s field &#8220;DefaultGroupNotificationFrequency&#8221; with the options:<\/p>\n<ul>\n<li>Email on each post<\/li>\n<li>Daily digests<\/li>\n<li>Weekly digests<\/li>\n<li>Never<\/li>\n<\/ul>\n<hr \/>\n<p><strong>190. Once email is sent via Workflow, can it be\u00a0tracked in Activity history related list ?<br \/>\nAns : <\/strong>No. If you think this is nice to have and usefull for Auditing purpose, <a title=\"Workflow email alerts should be recordable as activity history\" href=\"https:\/\/success.salesforce.com\/ideaView?id=08730000000BroKAAS&amp;sort=2\">please vote up and comment on this idea<\/a>.<\/p>\n<div class=\"intrinsic-container\"><iframe loading=\"lazy\" src=\"https:\/\/jitendrazaa.com\/blog\/SFDCInterviewList.php?num=19\" width=\"300\" height=\"150\" allowfullscreen=\"allowfullscreen\"> <\/iframe><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Salesforce interview questions for developers and admins around Apex, Visualforce, getting Salesforce object name on basis of Id, Apex API limits<\/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,9],"tags":[337,72,232,124,203,336,280],"class_list":["post-3773","post","type-post","status-publish","format-standard","hentry","category-apex","category-salesforce","tag-apex","tag-dataloader","tag-dynamic-apex","tag-interview-questions","tag-trigger","tag-visualforce","tag-workflow"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":2501,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4\/","url_meta":{"origin":3773,"position":0},"title":"Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex","author":"Jitendra","date":"November 27, 2011","format":false,"excerpt":"Most Frequently Asked interview questions of Apex, Dynamic Apex, SOSL, Visualforce, SOQL in Salesforce.com SFDC","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":3278,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/visualforce\/using-fieldset-with-visualforce-and-apex\/","url_meta":{"origin":3773,"position":1},"title":"Using FieldSet with Visualforce and Apex","author":"Jitendra","date":"May 3, 2013","format":false,"excerpt":"One of the disadvantages comes up with Custom Page or Overriding New or Edit button with Visualforce page is its \"Maintenance\"\u009d, if New Filed is Added or needed to remove field we have to modify our code every time. However, Thanks to Salesforce that we have \"Field Set\"\u009d. With the\u2026","rel":"","context":"In &quot;Apex&quot;","block_context":{"text":"Apex","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/apex\/"},"img":{"alt_text":"Create Field Set in Salesforce","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2013\/05\/Create-Field-Set-in-Salesforce.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2013\/05\/Create-Field-Set-in-Salesforce.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2013\/05\/Create-Field-Set-in-Salesforce.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2825,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions-part-7\/","url_meta":{"origin":3773,"position":2},"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":3025,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions-part-11\/","url_meta":{"origin":3773,"position":3},"title":"Salesforce Interview Questions \u2013 Part 11","author":"Jitendra","date":"August 19, 2012","format":false,"excerpt":"101. How to force lead assignment rule via Apex while updating or adding the Lead? Ans : To enforce Assignment Rules in Apex you will need to perform following steps: Instantiate the \"Database.DMLOptions\"\u009d class. Set the \"useDefaultRule\"\u009d property of \"assignmentRuleHeader\"\u009d to True. Finally call a native method on your Lead\u2026","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Pagination in SOQL using keyword Offset","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/08\/Pagination-in-SOQL-using-keyword-Offset.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/08\/Pagination-in-SOQL-using-keyword-Offset.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/08\/Pagination-in-SOQL-using-keyword-Offset.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":2979,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions-part-9\/","url_meta":{"origin":3773,"position":4},"title":"Salesforce Interview Questions \u2013 Part 9","author":"Jitendra","date":"July 25, 2012","format":false,"excerpt":"81. Which type of report can be used for dashboard components? Ans : Summary and matric report. 82. How many types of dashboard components are available? Ans : Chart, Table, Metric and Gauge. 83. Explain dynamic Dashboard. Ans : Dashboard which is running under current logged in user permission are\u2026","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Salesforce Analytic Snapshot - Source Report and Target Object","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/07\/Salesforce-Analytic-Snapshot-Source-Report-and-Target-Object.png?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":3773,"position":5},"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":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/3773","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=3773"}],"version-history":[{"count":19,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/3773\/revisions"}],"predecessor-version":[{"id":4856,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/3773\/revisions\/4856"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=3773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=3773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=3773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}