{"id":4303,"date":"2022-02-28T11:38:31","date_gmt":"2022-02-28T11:38:31","guid":{"rendered":"https:\/\/himbap.com\/blog\/?p=4303"},"modified":"2022-02-28T11:38:31","modified_gmt":"2022-02-28T11:38:31","slug":"fixing-uci-custom-view-filter-caching-issue","status":"publish","type":"post","link":"https:\/\/himbap.com\/blog\/?p=4303","title":{"rendered":"Fixing UCI Custom View Filter Caching Issue"},"content":{"rendered":"<p><strong>Problem<\/strong><br \/>\nCustomer filter is applied to system view because of caching<\/p>\n<p><strong>Details<\/strong><br \/>\nRecently we got one issue reported where system view was not displaying all the records based on the default filter, but when we tried to reproduce the issue when we tried to check the view directly but when we tried to follow steps based on the QA resource we found some customer filter is applied automatically to the view when user want accessing that view after opening specific entity form.<\/p>\n<p>While troubleshooting this issue I found we have a custom view filtering applied in the entity, where we had following code:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n            var ViewDisplayName = &quot;Displayname of the view&quot;;\r\n            var viewId = formContext.getControl(lookupfieldname).getDefaultView();\r\n            \/\/rest of the FetchXML code\r\n          \r\n           formContext.getControl(cra).addCustomView(viewId, entity, ViewDisplayName, fetchXML, layout, true);\r\n\r\n<\/pre>\n<p>In the above code we were using Default view id to set the custom view id and that was causing this issue, so we changed code using new hardcoded GUID like below<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n        \r\n            var viewId = &quot;new guid;\r\n            \/\/rest of the FetchXML code\r\n<\/pre>\n<p>After above changes our issue got resolved and our view had only default filter applied !!<\/p>\n<p><strong>Summary<\/strong><br \/>\nWhile setting custom view filter, we should not use CRM view id as this may add custom filter to the system view.<\/p>\n<p>Hope it will help someone!<br \/>\nKeep learning, Keep sharing !!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem Customer filter is applied to system view because of caching Details Recently we got one issue reported where system view was not displaying all the records based on the default filter, but when we tried to reproduce the issue when we tried to check the view directly but when we tried to follow steps based on the QA resource&#8230; <a href=\"https:\/\/himbap.com\/blog\/?p=4303\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[402,522],"tags":[970,971,972,969],"_links":{"self":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4303"}],"collection":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4303"}],"version-history":[{"count":3,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4303\/revisions"}],"predecessor-version":[{"id":4306,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4303\/revisions\/4306"}],"wp:attachment":[{"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/himbap.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}