Dynamics 365 Security tips – Can a user work with only team roles in Dynamics 365

Can a user work with only team roles in Dynamics 365

Recently I was conducting a training in Dynamics 365 where I got the same question. Just a quick thought and the answer that comes to mind is “Yes”. After all,

a user’s security role is the sum of the security roles directly assigned to the user + sum of the roles the user derives through it’s association with the Teams (provided teams are given security role)

And here I was, where a user is belonging to a team and the team has a security with all the right privileges assigned to make the user work in Dynamics.

When I assigned the role directly to the user and the user is not part of the team, it just worked fine. Now comes the other way round. I remove the user’s security role, assign the same security role to a team and add the user to the team.

image

As you can see, the security role is having pretty much everything to access this account.

Login screen below after the user logged in.

image

Looks awesome isn’t it. The user can see accounts as expected. Just when you think that you have won the hearts of participants heart with your awesome understanding of Dynamics, Dynamics would throw a stick or two at you.

So I clicked on Account and this is what I get below.

image

That facepalm moment where you are just thinking, what just happened?

Now time for some recovery. When I click on Advanced find and try to access accounts, I could see them just fine.

image

You can even create/ read/ write and do all the fancy stuffs as per the role privilege.

Now I just did this trick. I just created a dummy role with absolutely no privilege to any entity and added it to the user. And this time when I click on Sales –> accounts, it just works fine.

So next time when you are up to this, this can save you some awkward moments. Not sure if this a bug or expected behavior but it seems the problem is only with the Home Page grid. Even if I try to read/ write accounts with the user credentials programmatically using SDK.

For the home page grid to work, it requires a role to be assigned directly to the user.

Debajit Dutta (Dynamics MVP)

 

Error The user does not have read permissions to a secured field. while configuring Field Security

Error while configuring Field Security – The user does not have read permissions to a secured field.

Dynamics CRM never ceases to throw surprises to me and this even applies to the functionalities which were introduced way back in CRM 2011.

Recently in a session I was demoing field security and strangely one participant informed me that he is getting the below error while setting the field security profile for a user.

image

Cross checked whether he enabled field security for the field. And it was obvious he was doing with admin login. And strangely enough the error says “the user does have read permissions to the secured field”. Downloaded the error log but that didn’t help much as well.

image

This put me in a situation. Don’t know where to look into.

Suddenly I just published the entity again in frustration and after that when I tried, the error was gone. As it turned if you don’t publish the entity after enabling field security for a field and try to configure profile for the field, you get this error.

Publish is obvious but this kind of error message can throw you completely in a wrong direction.

Hope this tip may save you from some time and awkward moments.

-Debajit Dutta (Dynamics MVP)

 

Error: Could not load type ‘Xrm.XrmServiceContext’

Problem Introduction

It is very often to see this error, especially when you are developing a custom app/website connecting to CRM using Portal Extension method or Simplified Connection.

And actually, I learn it from mistake, I realized my mistake, small mistake that making my example not working.

So here is the step to resolve:

Have you followed this step?

https://msdn.microsoft.com/en-us/library/gg695790.aspx
When I say ‘have you’, are you really really comfortable to say yes? Have you really-really followed the instruction?
Well, if you think you ‘have’, it is not your fault, because I also did the same thing.
Now, I still face the error…What should I do?

1. Are you using the correct framework?

If you are using CRM 2015, then you should use .NET 4.5.2.
For CRM 2013, you should use .NET 4.5
And for CRM 4.0 is .NET 4.0

2. Try to check whether you have inserted the generated code

Please check again in your Project, have you inserted the generated code you generated from CrmSvcUtil?

3. Check again your web.config and ContextTypeName (in the ASPX) vs CRMScvUtil Parameters

This is very important, because this was the root of failure I did not realize before.
Here, you need to check first the CrmSvcUtil..
In fact..I generate this:

CrmSvcUtil Parameters

1
2
CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization,Microsoft.Xrm.Client.CodeGeneration" /url:"https://aileenexample.api.crm5.dynamics.com/XRMServices/2011/Organization.svc" /out:"XrmContext.cs" /username:admin@aileenexample.onmicrosoft.com /password:passwordme /namespace:Xrm /serviceContextName:"XrmContext"
pause

You seem my parameter for serviceContextname is “XrmContext”, not the “XrmServiceContext”!!

While I check my web.config:

Web.Config

1
2
3
4
5
<microsoft.xrm.client>
    <contexts>
      <add name="Xrm" type="Xrm.XrmServiceContext, Xrm.CRM.2015.WebExample" />
    </contexts>
</microsoft.xrm.client>

And also I check my .ASPX code

1
<asp:LinqDataSource ID="Contacts" ContextTypeName="Xrm.XrmServiceContext" TableName="ContactSet" runat="server" />

Well, I use both in my code :

Xrm.XrmServiceContext

While, I generate the code using servicecontext parameter to this:

image

Of course, it wont be able to load the type.

Then, what I do is, I change my web.config and my ASPX from

Xrm.XrmServiceContext

to

Xrm.XrmContext

Or you can re-generate the file and change the the /serviceContextName param from

“XrmContext” to “XrmServiceContext”

It is common mistake and sometimes is hard to realize!

Tips: Since you can have many changes in your CRM Metadata, you might need to re-generate your generated code very often, then I recommend you to consider the batch execution approach.

See this for detail:

http://missdynamicscrm.blogspot.sg/2014/05/crm-sdk-smart-way-to-use-crmsvcutilexe.html

Hope this saves your day!

Thanks!

Error : Plugin registration tool stopped connecting to Dynamics 365

 

In case you have been trying to get the Dynamics 365 SDK plugin registration tool to work for latest version of Dynamics 365 online and facing issues like this one:

· At making a connection stage the tool keeps on circling all the data centres and still does not connect and gives error such as Bad username or password

· Error during connection such as Bad request

· IF you pick specific data centre also, still get error while connecting.

Well, you need to download the latest plugin registration tool. Following simple steps help to download Dynamics 365 9.0 tools:

You can follow below steps with screens or for more details information look into Microsoft docs link

1. Open Power Shell from windows menu.

2. Navigate to folder location where tools will download.

clip_image002

3. Copy Paste following command in PowerShell command( referred from the Microsoft Link).

$sourceNugetExe = “https://dist.nuget.org/win-x86-commandline/latest/nuget.exe&#8221;

$targetNugetExe = “.nuget.exe”

Remove-Item .Tools -Force -Recurse -ErrorAction Ignore

Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe

Set-Alias nuget $targetNugetExe -Scope Global -Verbose

##

##Download Plugin Registration Tool

##

./nuget install Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool -O .Tools

md .ToolsPluginRegistration

$prtFolder = Get-ChildItem ./Tools | Where-Object

move .Tools$prtFoldertools*.* .ToolsPluginRegistration

Remove-Item .Tools$prtFolder -Force -Recurse

##

##Download CoreTools

##

./nuget install Microsoft.CrmSdk.CoreTools -O .Tools

md .ToolsCoreTools

$coreToolsFolder = Get-ChildItem ./Tools | Where-Object

move .Tools$coreToolsFoldercontentbincoretools*.* .ToolsCoreTools

Remove-Item .Tools$coreToolsFolder -Force -Recurse

##

##Download Configuration Migration

##

./nuget install Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf -O .Tools

md .ToolsConfigurationMigration

$configMigFolder = Get-ChildItem ./Tools | Where-Object

move .Tools$configMigFoldertools*.* .ToolsConfigurationMigration

Remove-Item .Tools$configMigFolder -Force -Recurse

##

##Download Package Deployer

##

./nuget install Microsoft.CrmSdk.XrmTooling.PackageDeployment.WPF -O .Tools

md .ToolsPackageDeployment

$pdFolder = Get-ChildItem ./Tools | Where-Object

move .Tools$pdFoldertools*.* .ToolsPackageDeployment

Remove-Item .Tools$pdFolder -Force -Recurse

##

##Remove NuGet.exe

##

Remove-Item nuget.exe

4. Hit enter button Tools will be downloaded in specific folder.

clip_image004

5. After successful execution of command check tools downloaded in specific location.

clip_image006

clip_image008

Try using this Plugin registration tool with latest version of Dynamics 365 and it will work just fine.

Hope it helps and Happy Learning.

Interested in Training: Click here

Any requirements in CRM/Dynamics 365 – end user,Microsoft  partner or an individual?

Requirement Area – Technical, Functional, Training, Development or consulting?

Written By 

Plugin registration tool stopped connecting to Dynamics 365

Plugin registration tool stopped connecting to Dynamics 365 , Unable to connect Plugin registration Tool

Plugin registration tool stopped connecting to Dynamics 365

In case you have been trying to get the Dynamics 365 SDK plugin registration tool to work for latest version of Dynamics 365 online and facing issues like this one:

· At making a connection stage the tool keeps on circling all the data centres and still does not connect and gives error such as Bad username or password

· Error during connection such as Bad request

· IF you pick specific data centre also, still get error while connecting.

Well, you need to download the latest plugin registration tool. Following simple steps help to download Dynamics 365 9.0 tools:

You can follow below steps with screens or for more details information look into Microsoft docs link

1. Open Power Shell from windows menu.

2. Navigate to folder location where tools will download.

clip_image002

3. Copy Paste following command in PowerShell command( referred from the Microsoft Link).

$sourceNugetExe = “https://dist.nuget.org/win-x86-commandline/latest/nuget.exe&#8221;

$targetNugetExe = “.nuget.exe”

Remove-Item .Tools -Force -Recurse -ErrorAction Ignore

Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe

Set-Alias nuget $targetNugetExe -Scope Global -Verbose

##

##Download Plugin Registration Tool

##

./nuget install Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool -O .Tools

md .ToolsPluginRegistration

$prtFolder = Get-ChildItem ./Tools | Where-Object

move .Tools$prtFoldertools*.* .ToolsPluginRegistration

Remove-Item .Tools$prtFolder -Force -Recurse

##

##Download CoreTools

##

./nuget install Microsoft.CrmSdk.CoreTools -O .Tools

md .ToolsCoreTools

$coreToolsFolder = Get-ChildItem ./Tools | Where-Object

move .Tools$coreToolsFoldercontentbincoretools*.* .ToolsCoreTools

Remove-Item .Tools$coreToolsFolder -Force -Recurse

##

##Download Configuration Migration

##

./nuget install Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf -O .Tools

md .ToolsConfigurationMigration

$configMigFolder = Get-ChildItem ./Tools | Where-Object

move .Tools$configMigFoldertools*.* .ToolsConfigurationMigration

Remove-Item .Tools$configMigFolder -Force -Recurse

##

##Download Package Deployer

##

./nuget install Microsoft.CrmSdk.XrmTooling.PackageDeployment.WPF -O .Tools

md .ToolsPackageDeployment

$pdFolder = Get-ChildItem ./Tools | Where-Object

move .Tools$pdFoldertools*.* .ToolsPackageDeployment

Remove-Item .Tools$pdFolder -Force -Recurse

##

##Remove NuGet.exe

##

Remove-Item nuget.exe

4. Hit enter button Tools will be downloaded in specific folder.

clip_image004

5. After successful execution of command check tools downloaded in specific location.

clip_image006

clip_image008

Try using this Plugin registration tool with latest version of Dynamics 365 and it will work just fine.

Hope it helps and Happy Learning.

Written by Deepesh Somani, do visit his blog

Plugin registration tool stopped connecting to Dynamics 365