3
votes

We have developed a portal using the code from the customer portal. But we haven't used the customer portal solution on the CRM server. Everything is working fine except caching prevents updates to show on the portal.

In CRM 4 I used this solution http://pogo69.wordpress.com/2010/11/05/caching-revisited-crm-4-0-sdk-advanced-developer-extensions/. But this doesn't work in CRM 2011 because Microsoft.Xrm.Client.Caching is different. How do I clear the cache for 2011?

Any help or thoughts would be greatly appreciated.

Thanks!

3

3 Answers

1
votes

Make sure that you have a cache invalidation URL configured. The PRM portal has a service that invalidates the cache with any update/create event (managed by a plugin registered on all entities).

Go To Settings -> Web Notification URL, either update the URL to the Cache.axd file or create a new entry.

If this is all in place, I would make sure that the plugin that takes care of calling the cache invalidation is working/registered as it should be.

Hope that helps

1
votes

See the following article for more details on the Web Notification URL.

Set Up Cache Invalidation to Refresh Changes on the Website

0
votes

I found that removing the preloadcache parameter & value from URLs bypasses CRM's cache. Not ideal but it worked. Your mileage may vary...

    <script type="text/javascript">
        bypassCrmPreloadCache();    // DE_WR_15706 Bypass 30sec cache to get latest version #


        function bypassCrmPreloadCache() {
            var ParentURL = window.parent.location.href;
            var nStartPreloadcache = ParentURL.indexOf("preloadcache");
            if (nStartPreloadcache > 0) {
                // Parent URL is cached
                var nEnd = ParentURL.indexOf("&", nStartPreloadcache);
                if (nEnd == -1) { // Special case: no ampersand => preloadcache is last argument.
                    nEnd = ParentURL.length; // End of URL is end of preloadcache's value.      
                }
                var strPreloadCacheParamAndValue = ParentURL.substr(nStartPreloadcache, 1 + nEnd - nStartPreloadcache);
                // Remove preloadcache-parameter from URL
                ParentURL = ParentURL.replace(strPreloadCacheParamAndValue, "");
                if (ParentURL.charAt(ParentURL.length-1) == '&')
                    ParentURL = ParentURL.slice(0, -1); // Ensure URL not terminated by an unnecessary '&'.

                // Load URL in parent Window, bypassing the cache
                window.open(ParentURL, "_parent");
            }
        }
</script>