Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications


Setting security for Entity navigation pane

Post Author: Joe D365 |

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.

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!

 

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

Leave a Reply

Your email address will not be published. Required fields are marked *

PowerObjects Recommends