{"id":113,"date":"2013-11-07T07:28:39","date_gmt":"2013-11-07T07:28:39","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/salesforce\/?p=113"},"modified":"2025-05-15T09:07:49","modified_gmt":"2025-05-15T09:07:49","slug":"changing-the-date-range-in-standard-salesforce-calendar","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/11\/07\/changing-the-date-range-in-standard-salesforce-calendar\/","title":{"rendered":"Changing the date range in standard Salesforce Calendar"},"content":{"rendered":"<p>The Standard Salesforce calendar allows the user to select only a limited number of years from the dropdown list i.e. it shows limited years in the year dropdown. If the user wants to select the dates prior to the date or after the date available in the dropdown then he has to manually enter the entire date. This can sometimes cause trouble to the users. In order to overcome this, we have added some jquery code to the visual force page to change the year range that will be displayed in the dropdown.<\/p>\n<p><span style=\"color: #800000;\"><span style=\"color: #000000;\"><em><strong>New Stuff<\/strong><\/em><\/span>:<\/span>\u00a0\u00a0<a title=\"Get Key Prefix\/Object id of Object in JavaScript\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/11\/02\/get-key-prefixobject-id-of-object-in-javascript\/\" target=\"_blank\" rel=\"noopener\">Get Key Prefix\/Object id of Object in JavaScript<\/a><\/p>\n<p>Let\u2019s take an example of Contacts object where the user needs to add birthdate to the record. Here the possibility of selecting a date from the dropdown is very slim i.e. there may not be many people who have their birthdate in the given range.<a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2013\/11\/Fig.11.jpg\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-114 size-full\" title=\"Fig.1\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2013\/11\/Fig.11.jpg\" alt=\"Fig.1\" width=\"302\" height=\"199\" \/><\/a><\/p>\n<p>Hence we made some tweaks in the jquery of visual force page for contacts to change the year range.<\/p>\n<p>First we need to add a reference of the jquery which you can get directly from the googleapis libraries. The code to include jquery in your visual force page is as follows &#8211;<a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2013\/11\/Code1.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-116\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2013\/11\/Code1.jpg\" alt=\"Code1\" width=\"673\" height=\"21\" \/><\/a>And on the ready event or on the load event of the page, clear the html of the year dropdown and add the required range of years. In the below example, we have added the range from 1970 to 2018 which will allow the users to select the dates ranging from 1<sup>st<\/sup> Jan 1970 to 31<sup>st<\/sup> Dec 2018.<\/p>\n<p><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2013\/11\/Code2.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-117\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2013\/11\/Code2.jpg\" alt=\"Code2\" width=\"695\" height=\"131\" \/><\/a><\/p>\n<p>Rest of the code in the visual force page will remain the same.<\/p>\n<p>Here is the output of the above code with the new date range dropdown &#8211;<\/p>\n<p><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2013\/11\/Fig.21.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-115 size-full\" title=\"Fig.2\" src=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-content\/uploads\/2013\/11\/Fig.21.jpg\" alt=\"Fig.2\" width=\"302\" height=\"340\" \/><\/a><\/p>\n<p>As we can see from the above image, the date range has been expanded to display a much wider range of years and the user can now directly select any date from the dropdown.<\/p>\n<p><span style=\"font-size: Medium;\"><strong>About Us<\/strong><\/span><br \/>\n<a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a> as a Salesforce Product development partner offers a wide variety of integration products and services to the end users as well as to the Partners across the globe. We offer Consultation, Configuration, Training and support services in out-of-the-box functionality as well as customizations to incorporate custom business rules and functionalities that requires apex code incorporation into the Salesforce platform.<\/p>\n<p><a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a> has some unique solutions for Cloud CRM such as Salesforce integration with <a href=\"https:\/\/www.greytrix.com\/product\/sage-x3\/gumu-x3-salesforce-integration\">Sage Enterprise Management (Sage X3<\/a>), Sage Intacct, <a href=\"https:\/\/www.greytrix.com\/product\/sage-100-erp\/gumu-100-salesforce-integration\">Sage 100, <\/a>and <a href=\"https:\/\/www.greytrix.com\/product\/sage-300-erp\/gumu-300-salesforce-integration\">Sage 300 (Sage Accpac)<\/a>. We also offer best-in-class Cloud CRM <a href=\"https:\/\/www.greytrix.com\/product\/crm-development\/salesforce-com\">Salesforce customization and development services<\/a> along with services such as Salesforce <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/data-migration-services\">Data Migration<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/integrated-application-development\">Integrated App development<\/a>, <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/custom-development\">Custom App development<\/a>, and <a href=\"https:\/\/www.greytrix.com\/product\/professional-services\/maintenance-support\">Technical Support<\/a> to business partners and end users.<\/p>\n<p>Greytrix GUMU&#x2122; integration for Sage ERP \u2013 Salesforce is a 5-star app listed on <a href=\"https:\/\/appexchange.salesforce.com\/listingDetail?listingId=a0N30000000psM5EAI\" target=\"_blank\" rel=\"noopener\">Salesforce AppExchange<\/a>.<\/p>\n<p>For more information, please contact us at <a href=\"mailto:salesforce@greytrix.com\">salesforce@greytrix.com<\/a>. We will be glad to assist you.<\/p>\n<p><strong><span style=\"font-size: Medium;\">Related Posts<\/span><\/strong><\/p>\n<ul>\n<li><a title=\"Mapping custom lead fields to standard contact fields\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/11\/01\/mapping-custom-lead-fields-to-standard-contact-fields\/\" target=\"_blank\" rel=\"noopener\">Mapping custom lead fields to standard contact fields<\/a><\/li>\n<li><a title=\"Overriding standard visual page styling in Salesforce\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/10\/23\/overriding-standard-visual-page-styling-in-salesforce\/\" target=\"_blank\" rel=\"noopener\">Overriding standard visual page styling in Salesforce<\/a><\/li>\n<li><a title=\"Assign custom object permissions to Standard User in Salesforce\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/06\/11\/assign-custom-object-permissions-to-standard-user-in-salesforce\/\" target=\"_blank\" rel=\"noopener\">Assign custom object permissions to Standard User in Salesforce<\/a><\/li>\n<li><a title=\"Mapping Custom Lead Fields in Salesforce\" href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/08\/23\/mapping-custom-lead-fields-in-salesforce\/\" target=\"_blank\" rel=\"noopener\">Mapping Custom Lead Fields in Salesforce<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The Standard Salesforce calendar allows the user to select only a limited number of years from the dropdown list i.e. it shows limited years in the year dropdown. If the user wants to select the dates prior to the date or after the date available in the dropdown then he has to manually enter the\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/salesforce\/2013\/11\/07\/changing-the-date-range-in-standard-salesforce-calendar\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[38,53,554,553,555],"class_list":["post-113","post","type-post","status-publish","format-standard","hentry","category-salesforce-srv","tag-calendar","tag-contact","tag-date-range-in-calendar","tag-salesforce-calendar","tag-visual-force"],"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/comments?post=113"}],"version-history":[{"count":5,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/113\/revisions"}],"predecessor-version":[{"id":10792,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/posts\/113\/revisions\/10792"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/media?parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/categories?post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/salesforce\/wp-json\/wp\/v2\/tags?post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}