Hide options for specific users from Menu bar

By | June 21, 2016

Sage CRM has number of built in functions using which user can make most out of the system. Similarly, using client side API we can help our customers by incorporating their requirement with the help of scripting.

New Stuff: Center Align List/Grid Data

Recently, for one of our customers we wanted to restrict Menu bar for specific users. To fulfill this requirement we followed the below mentioned steps:

1. Go to Administration section | Customization | Translation.
2. Create a new translation with the below given details.

Img1

3. Here in above screen, you have to enter User IDs in “US Translation” and “UK Translation” field to restrict users to view the options.
4. Click on Save button.
5. The below script will actually execute the function to hide the Menu options from CRM. Hence, we need to create a .JS file.

Function Hidemenus()
{
if(document.getElementsByClassName(“TOPHEADING TitleIcon”))
{
document.getElementsByClassName (“TOPHEADING TitleIcon”) [0].innerHTML=””;
}
var sUserid=new String(crm.getArg(“key4”,crm.url()));
var sUserIdFromTrans=new String(crm.getTrans(“UserProfiles”,”UserProfiles”));

if(sUserIdFromTrans.indexOf(sUserid)>=0)
{
if(document.getElementsByClassName(“er_new”)[0])
{
document.getElementsByClassName(“er_new”)[0].innerHTML=””;
}
if(document.getElementById(“find-list”))
{
document.getElementById(“find-list”).style.visibility = “hidden”;
}
//Hide Recent-List
if($(‘#recent-list’))
{
$(‘#recent-list’).hide()
}
//Hide Notification
$(‘#notiflabel’).each(function()
{
$(this).parent().hide();
});
}
If (document.getElementsByClassName(“TOPCAPTION TOPHEADING TOPCONTENTVALUE”)[0])
{
var InteractiveHTML=document.getElementsByClassName(“TOPCAPTION TOPHEADING TOPCONTENTVALUE”)[0].innerHTML;
InteractiveHTML=InteractiveHTML.replace(“<h2>Interactive&nbsp;Dashboard</h2>”,””);
document.getElementsByClassName (“TOPCAPTION TOPHEADING TOPCONTENTVALUE”)[0].innerHTML=InteractiveHTML;
}
}

6. Copy the above file under Custom Pages and log in to CRM to see the below effect.

IMG3

Also Read:

1. Highlight fields using Client side API in Sage CRM
2. JavaScript to print Amount (In Words)
3. Calling Javascript function from Workflow progress screen
4. Tips and Tricks about Calling function in Custom Content of Sage CRM 7.2
5. Changing Link text of URL fields