Sitecore – Update value from Sitecore Registry

The Sitecore registry contains useful information about the user. For example, the different checkboxes that needs to be checked or unchecked in the ribbon is managed by the registry. This allows to gain in performance.

During this small post, I will explain on how you can update the registry value of the checkbox which control the visibility of the Entire Tree

1v7zf.png

So, you need first to add a processor to the loggedin as shown below:

Save the file with the filename z.SitecoreRegistryPatch.config and place it in the Include folder. Once you specified the processor, you need to write the code which will be responsible to trigger the update on the registry. The code snippet is shown below:

From the code above, you need to get the current user which is being log into the CMS. Then, generate the key. The Profile contains all the different registry associated with the user and it acts as a Dictionary. So, you only need to search the desired key in the dictionary for it to provide the value. In this case, we are passing a key which is responsible for the Entire Tree checkbox. We then set the value to true and perform a save.

You also require to clear the cache. By making use of the Sitecore.Context.Site, at this point in time, the site will be login and we need to clear the cache for the shell site. It is the shell site which is responsible for the CMS.

I will be posting a more detail about the different registry entries and their purpose in future blog post. Stay tuned! 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s