• Home
  • About Us
  • Contact Us
  • Privacy Policy
  • Special Offers
Business Intelligence Info
  • Business Intelligence
    • BI News and Info
    • Big Data
    • Mobile and Cloud
    • Self-Service BI
  • CRM
    • CRM News and Info
    • InfusionSoft
    • Microsoft Dynamics CRM
    • NetSuite
    • OnContact
    • Salesforce
    • Workbooks
  • Data Mining
    • Pentaho
    • Sisense
    • Tableau
    • TIBCO Spotfire
  • Data Warehousing
    • DWH News and Info
    • IBM DB2
    • Microsoft SQL Server
    • Oracle
    • Teradata
  • Predictive Analytics
    • FICO
    • KNIME
    • Mathematica
    • Matlab
    • Minitab
    • RapidMiner
    • Revolution
    • SAP
    • SAS/SPSS
  • Humor

Get User Security Role Name from context in Dynamics 365 CE

April 20, 2020   Microsoft Dynamics CRM

Microsoft Dynamics 365 CE/CRM now has a more streamlined method to get the running users security role name without having to make a client-side API call. In the spring of 2020 there has been an update to the SDK to mark the deprecation of userSettings.securityRoles. It has been replaced with userSettings.roles.

 Get User Security Role Name from context in Dynamics 365 CE

 Get User Security Role Name from context in Dynamics 365 CE

userSettings.roles provides not only the security role guids from the global context, but the security role names as well.

A common design pattern in use today is to enable/disable or hide/show client-side form attributes as a part of controlling a business logic form flow. This has been achieved with a JavaScript WebResource in several different patterns. The challenge is that quite a few patterns can cause poor client-side performance, especially in high latency environments. Here are some example conversations from the Microsoft Dynamics CRM Forum community on the subject:

If you are fortunate enough to have engaged with a Dynamics 365 CE/CRM DSE or a Microsoft in a Performance Delivery, you may have been provided a sample JavaScript pattern using browser caching that alleviated unnecessary Web API calls.

Hiccup Note: While writing this blog I uncovered a bug where the name values are incorrect when an Owner Team is providing additional security roles. There is already a bug in place and is targeting the 4.4 train (end of May 2020) release. In mean time feel test on a development environment in preparation for the bug fix release. I will be updating this blog to remove this statement one the the fix has reached North America. Please check back and/or follow this blog post for updates.

So let’s take a look at a JavaScript sample that uses the new userSettings.roles

 Get User Security Role Name from context in Dynamics 365 CE

Add a JavaScript web resource.

Add the web resource as a reference on a Case form.

Register CaseForm.FromOnload on the Case form Onload event.

Publish the changes.

Identify a test user with security roles for testing.

Open a Case record.

Now we can inspect the Developer Tools (F12) in the browser (example here in Microsoft Edge based on Chromium). Note: you might need to refresh the form with a Shift+F5 to replay the form load.

We see we get the global context and inspect userSettings.roles by hovering the cursor over roles.

5857 Get User Security Role Name from context in Dynamics 365 CE

By expanding  _collection: we see the running user security role guids …

8585 Get User Security Role Name from context in Dynamics 365 CE

And if we scroll to the right we see the corresponding security role name …

1185 Get User Security Role Name from context in Dynamics 365 CE

Let’s block ads! (Why?)

Dynamics 365 Customer Engagement in the Field

context, Dynamics, from, Name, role, Security, User
  • Recent Posts

    • NOW, THIS IS WHAT I CALL AVANTE-GARDE!
    • Why the open banking movement is gaining momentum (VB Live)
    • OUR MAGNIFICENT UNIVERSE
    • What to Avoid When Creating an Intranet
    • Is Your Business Ready for the New Generation of Analytics?
  • Categories

  • Archives

    • January 2021
    • December 2020
    • November 2020
    • October 2020
    • September 2020
    • August 2020
    • July 2020
    • June 2020
    • May 2020
    • April 2020
    • March 2020
    • February 2020
    • January 2020
    • December 2019
    • November 2019
    • October 2019
    • September 2019
    • August 2019
    • July 2019
    • June 2019
    • May 2019
    • April 2019
    • March 2019
    • February 2019
    • January 2019
    • December 2018
    • November 2018
    • October 2018
    • September 2018
    • August 2018
    • July 2018
    • June 2018
    • May 2018
    • April 2018
    • March 2018
    • February 2018
    • January 2018
    • December 2017
    • November 2017
    • October 2017
    • September 2017
    • August 2017
    • July 2017
    • June 2017
    • May 2017
    • April 2017
    • March 2017
    • February 2017
    • January 2017
    • December 2016
    • November 2016
    • October 2016
    • September 2016
    • August 2016
    • July 2016
    • June 2016
    • May 2016
    • April 2016
    • March 2016
    • February 2016
    • January 2016
    • December 2015
    • November 2015
    • October 2015
    • September 2015
    • August 2015
    • July 2015
    • June 2015
    • May 2015
    • April 2015
    • March 2015
    • February 2015
    • January 2015
    • December 2014
    • November 2014
© 2021 Business Intelligence Info
Power BI Training | G Com Solutions Limited