Block User tab Customization

By | April 7, 2011

Adding and removing tabs to the tab-groups is and administrative tasks in CRM. As per the application security standards in CRM we can also implement tab level securities in order to avoid access of the tabs to certain user or user profiles. This is very easy and straight forward task. However CRM also provides a way for user to customize the way the tabs are displayed in his context of company, person etc. You can see at the end of tabs panel there is an image with three white dots clicking which you can open the user tab customization window. User can add or remove the tabs of his choice as per the view needed.

The above screenshot is of Person context. Here user can remove the tabs if he doesn’t want to see them in his view.

However the requirement in my internal CRM was not to allow users to play around the tabs and they must not change the user’s tab-group view. In short I want to block the User tab Customization area for the users. Well, this seems to be quite complicated task, but through client side script it is fairly simple job. Basically the tab to access this functionality is an image with three white dots named UserCustomizeTab.gif. All we have to do is just to find this image tag and disable the on-click event for the same from client side. Below given is the client side script that can be used for the same.

Script

< script for=window event=onload >
fn_onload();
< /script >

< script language=javascript >
//’Onload function
function fn_onload()
{
var ObjAllImages = document.getElementsByTagName(“IMG”);
for(i=0;i < =ObjAllImages.length-1;i++)
{
sTabImgSRC = ObjAllImages[i].src;
sTabImgSRC = new String(sTabImgSRC);
if(sTabImgSRC.search(“UserCustomizeTab.gif”) > =0)
{
ObjAllImages[i].onclick = function(){ return false;
} } } }
< /script >

This script will disable the User tab customization popup. Well, I tried this script on person summary screen and it works fine. But this won’t work if I switch the tab let’s say from Summary to Quick Look as I will be losing the context of the screen where the script is written. So to achieve the same on all the tabs we have to write the client side code in tab name translation. Summary tab name that is displayed comes from the translations. We have to find this translation and write above client side script on the same. This way even if the screen on tab summary doesn’t load, summary translation does loads and hence our script will run every time in the person context. You can go through the Jeff’s blog to understand how to add client side scripts in translations.

If you find this content useful, please drop us an email at crm@greytrix.com.