POWEROBJECTS

718 Washington Ave. N. Suite #101
Minneapolis, MN 55401
View map and all Locations

Send us a message

Many times we have come across the need to set privileges using Sitemap. The SiteMap defines the areas represented in the CRM client’s main application Navigation Pane. We use the predefined privilege tags to achieve this.

crm2011

Same feature is not available for entity Navigation Pane using isv.config. For implementing Role based security in Entity navigation pane, im presenting an example here.

In the example, we want to display Budget Spreadsheet link only if user has Read access to Budget Header entity.

Nav Pane

We create a new Role, say ‘Budget Read’ and give it Read rights for Budget Header entity. Next, we assign this role to all users we want to give Read access on Budget Header entity.

Check the Id of Budget Spreadsheet in Navigation pane using IE Dev toolbar. On the formload, write the following JS:

var bsheet = document.getElementById(‘navIsvBudgetSpreadsheet’);
bsheet.style.display=’none’;

GetCurrentUserRoles()

(Save the above file as txt file to view code)

function UserHasRole(roleName)
{
//get Current User Roles, oXml is an object
var oXml = GetCurrentUserRoles();
if(oXml != null)
{
//select the node text
var roles = oXml.selectNodes(“//BusinessEntity/q1:name”);
if(roles != null)
{
for( i = 0; i < roles.length; i++)
{
if(roles[i].text == roleName)
return true
}
}
}
return false
}

if(UserHasRole(‘BudgetRead’))
{
var bsheet = document.getElementById(‘navIsvBudgetSpreadsheet’);
bsheet.style.display=”;
}

Thats it! You’re ready to test your changes. Ofcourse there can be plenty of options you can exercise using similar techniques. Happy programming!

 

Avatar for JoeCRM

JoeCRM

Joe CRM is a CRM superhero who runs on pure Microsoft Dynamics CRM adrenaline. As the face of PowerObjects, Joe CRM’s mission is to reveal innovative ways to use Dynamics CRM and bring the application to more businesses and organizations around the world.