{"id":288,"date":"2011-01-03T08:26:00","date_gmt":"2011-01-03T08:26:00","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/sagecrm\/?p=288"},"modified":"2023-10-06T09:13:09","modified_gmt":"2023-10-06T09:13:09","slug":"custom-filter-screen-with-default-filter-on-date-field-options","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/","title":{"rendered":"Custom filter screen with default filter on Date Field options"},"content":{"rendered":"<p>Earlier I had posted a blog:<\/p>\n<p><a href=\"http:\/\/sagecrmaddons.blogspot.com\/2010\/12\/date-ing-tips.html\" target=\"_blank\" rel=\"noopener\">http:\/\/sagecrmaddons.blogspot.com\/2010\/12\/date-ing-tips.html<\/a><\/p>\n<p>In which I had elaborated how to handle the date field in the custom search screen as it is little bit tedious task to do.<\/p>\n<p>Now in this section I will be more descriptive on how to make the date field default in the custom filters.<\/p>\n<p>Some days ago my client was came up with the requirement that they would like to have a custom list prefilled based on the last week so that the system performance would be improved. The entries which have been made within last week should auto-populated whenever user visits the screen first time. I had done some RND stuff and came to know that yes it can be doable in Sage CRM. We can set the default values in the date field which looks something like:<\/p>\n<div class=\"separator\" style=\"clear: both; text-align: center;\"><a style=\"clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;\" href=\"http:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/TSGEjWb-saI\/AAAAAAAABOg\/VQKHoq7UYZY\/s1600\/clip_image002.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/TSGEjWb-saI\/AAAAAAAABOg\/VQKHoq7UYZY\/s320\/clip_image002.jpg\" alt=\"Default values in the date field\" width=\"202\" height=\"57\" border=\"0\" \/><\/a><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"http:\/\/4.bp.blogspot.com\/_A6_b0zkYeSY\/TSGEncGbf9I\/AAAAAAAABOo\/I7VPjDKK7_k\/s1600\/clip_image003.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/4.bp.blogspot.com\/_A6_b0zkYeSY\/TSGEncGbf9I\/AAAAAAAABOo\/I7VPjDKK7_k\/s320\/clip_image003.jpg\" alt=\"default values in the date field\" width=\"162\" height=\"54\" border=\"0\" \/><\/a><\/div>\n<div class=\"separator\" style=\"clear: both; text-align: center;\"><\/div>\n<p>In order to achieve this we just need to do client side coding to set the corresponding list and field values. I searched on forum and found the code for the same which was like:<\/p>\n<fieldset>\n<legend>Script<\/legend>\n<p>window.attachEvent(&#8220;onload&#8221;,fillfields);<\/p>\n<p>function GetKeyValue(querystringname)<br \/>\n{<br \/>\nvar strPath = window.location.search.substring(1);<br \/>\nvar arrayKeys = strPath.split(&#8221; &amp; &#8220;);<br \/>\nfor (var i=0;i&lt; arrayKeys.length;i++)<br \/>\n{<br \/>\nvar arrayValue = arrayKeys[i].split(&#8220;=&#8221;);<br \/>\nif (arrayValue[0].toLowerCase()== querystringname.toLowerCase())<br \/>\n{<br \/>\nreturn arrayValue[1];<br \/>\n}<br \/>\n}<br \/>\nreturn &#8220;&#8221;;<br \/>\n}<\/p>\n<p>function fillfields()<br \/>\n{<br \/>\nif (!document.getElementById(&#8216;HIDDENPAGENUMBER&#8217;))<br \/>\n{<br \/>\ndocument.forms[0].DateTimeModescomm_datetime.selectedIndex=1;<br \/>\nvar bRelative = (document.forms[0].DateTimeModescomm_datetime.value == &#8216;Relative&#8217;);<br \/>\ndocument.all.divcomm_datetimeBetween.style.visibility = (!bRelative) ? &#8216;visible&#8217; : &#8216;hidden&#8217;;<br \/>\ndocument.all.divcomm_datetimeRelative.style.visibility = (bRelative) ? &#8216;visible&#8217; : &#8216;hidden&#8217;;<br \/>\n}<br \/>\n}<\/fieldset>\n<p>Actually whenever we add a date field on the search screen CRM internally creates few of the fields to handle its functionality like:<\/p>\n<p>&#8211; DateTimeModescomp_uploaddate<br \/>\n&#8211; comp_uploaddate_relative<br \/>\n&#8211; divcomp_uploaddateBetween<\/p>\n<p>We need to set the expected value whenever screen loads first time.<\/p>\n<p>Hope everybody would like to implement this to improve the performance of CRM if the large amount of data to be loaded in the list.<\/p>\n<p><b>For queries regarding the functionality, please feel free to drop us an email at <a title=\"mailto:crm@greytrix.com\" href=\"mailto:crm@greytrix.com\">crm@greytrix.com<\/a>. <\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Earlier I had posted a blog: http:\/\/sagecrmaddons.blogspot.com\/2010\/12\/date-ing-tips.html In which I had elaborated how to handle the date field in the custom search screen as it is little bit tedious task to do. Now in this section I will be more descriptive on how to make the date field default in the custom filters. Some days\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/\">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":[332],"tags":[833,924,1905],"class_list":["post-288","post","type-post","status-publish","format-standard","hentry","category-sage-crm","tag-crm7-0","tag-date","tag-relative"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Custom filter screen with default filter on Date Field options - Sage CRM \u2013 Tips, Tricks and Components<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom filter screen with default filter on Date Field options - Sage CRM \u2013 Tips, Tricks and Components\" \/>\n<meta property=\"og:description\" content=\"Earlier I had posted a blog: http:\/\/sagecrmaddons.blogspot.com\/2010\/12\/date-ing-tips.html In which I had elaborated how to handle the date field in the custom search screen as it is little bit tedious task to do. Now in this section I will be more descriptive on how to make the date field default in the custom filters. Some days\u2026 Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/\" \/>\n<meta property=\"og:site_name\" content=\"Sage CRM \u2013 Tips, Tricks and Components\" \/>\n<meta property=\"article:published_time\" content=\"2011-01-03T08:26:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-06T09:13:09+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/TSGEjWb-saI\/AAAAAAAABOg\/VQKHoq7UYZY\/s320\/clip_image002.jpg\" \/>\n<meta name=\"author\" content=\"greysagecrm\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"greysagecrm\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/\",\"name\":\"Custom filter screen with default filter on Date Field options - Sage CRM \u2013 Tips, Tricks and Components\",\"isPartOf\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/TSGEjWb-saI\/AAAAAAAABOg\/VQKHoq7UYZY\/s320\/clip_image002.jpg\",\"datePublished\":\"2011-01-03T08:26:00+00:00\",\"dateModified\":\"2023-10-06T09:13:09+00:00\",\"author\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/#primaryimage\",\"url\":\"http:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/TSGEjWb-saI\/AAAAAAAABOg\/VQKHoq7UYZY\/s320\/clip_image002.jpg\",\"contentUrl\":\"http:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/TSGEjWb-saI\/AAAAAAAABOg\/VQKHoq7UYZY\/s320\/clip_image002.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Custom filter screen with default filter on Date Field options\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/\",\"name\":\"Sage CRM \u2013 Tips, Tricks and Components\",\"description\":\"Explore the possibilities with Sage CRM insights through our comprehensive blogs. As a leading Sage partner, Greytrix helps businesses maximize their Sage CRM potential with its rich expertise and immense knowledge. Here, you will find blogs that feature expert advice, tips &amp; tricks, best practices, and comprehensive guides on customizing and configuring Sage CRM for your business. Stay informed with our regular updates and expert insights!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f\",\"name\":\"greysagecrm\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g\",\"caption\":\"greysagecrm\"},\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagecrm\/author\/greysagecrm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Custom filter screen with default filter on Date Field options - Sage CRM \u2013 Tips, Tricks and Components","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/","og_locale":"en_US","og_type":"article","og_title":"Custom filter screen with default filter on Date Field options - Sage CRM \u2013 Tips, Tricks and Components","og_description":"Earlier I had posted a blog: http:\/\/sagecrmaddons.blogspot.com\/2010\/12\/date-ing-tips.html In which I had elaborated how to handle the date field in the custom search screen as it is little bit tedious task to do. Now in this section I will be more descriptive on how to make the date field default in the custom filters. Some days\u2026 Read More &raquo;","og_url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/","og_site_name":"Sage CRM \u2013 Tips, Tricks and Components","article_published_time":"2011-01-03T08:26:00+00:00","article_modified_time":"2023-10-06T09:13:09+00:00","og_image":[{"url":"http:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/TSGEjWb-saI\/AAAAAAAABOg\/VQKHoq7UYZY\/s320\/clip_image002.jpg","type":"","width":"","height":""}],"author":"greysagecrm","twitter_card":"summary_large_image","twitter_misc":{"Written by":"greysagecrm","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/","url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/","name":"Custom filter screen with default filter on Date Field options - Sage CRM \u2013 Tips, Tricks and Components","isPartOf":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/#primaryimage"},"image":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/#primaryimage"},"thumbnailUrl":"http:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/TSGEjWb-saI\/AAAAAAAABOg\/VQKHoq7UYZY\/s320\/clip_image002.jpg","datePublished":"2011-01-03T08:26:00+00:00","dateModified":"2023-10-06T09:13:09+00:00","author":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f"},"breadcrumb":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/#primaryimage","url":"http:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/TSGEjWb-saI\/AAAAAAAABOg\/VQKHoq7UYZY\/s320\/clip_image002.jpg","contentUrl":"http:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/TSGEjWb-saI\/AAAAAAAABOg\/VQKHoq7UYZY\/s320\/clip_image002.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/2011\/01\/03\/custom-filter-screen-with-default-filter-on-date-field-options\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/"},{"@type":"ListItem","position":2,"name":"Custom filter screen with default filter on Date Field options"}]},{"@type":"WebSite","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#website","url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/","name":"Sage CRM \u2013 Tips, Tricks and Components","description":"Explore the possibilities with Sage CRM insights through our comprehensive blogs. As a leading Sage partner, Greytrix helps businesses maximize their Sage CRM potential with its rich expertise and immense knowledge. Here, you will find blogs that feature expert advice, tips &amp; tricks, best practices, and comprehensive guides on customizing and configuring Sage CRM for your business. Stay informed with our regular updates and expert insights!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/e7ff1c8f4763b47730d6bc5e74d59c1f","name":"greysagecrm","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g","caption":"greysagecrm"},"url":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/author\/greysagecrm\/"}]}},"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts\/288","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/comments?post=288"}],"version-history":[{"count":1,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts\/288\/revisions"}],"predecessor-version":[{"id":27885,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/posts\/288\/revisions\/27885"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/media?parent=288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/categories?post=288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagecrm\/wp-json\/wp\/v2\/tags?post=288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}