CRM 2015 – Advanced find to return all enabled users with a security role

I had a requirement to find all the users who had a security role because I needed to update a value.

Advanced find is easy to find

I am a big fan of the advanced find and have been known to have many open at the same time

Why the advanced find is a CRM Developers best friend

In CRM 2013 Microsoft made it difficult to find the Advanced (Why Microsoft why?).  I often had to think how to find the advanced find which is a big no no in UX design (Good CRM design should not make users think)

The bad treatment of the advanced find caused one CRM developer to create a solution which added the advanced find to every record

CRM 2013 Tool – Advanced Find on record forms for CRM 2013

Security Priviledges

If you have users who don’t have security roles you will see this (annoying) message

Advanced find users with security roles 1

The common reason for the message above is due to users being added and not yet given any security roles, which is usually because someone forget or they are being lazy

Other reasons for users having no security roles is moving users between business units.  When you move a user between business units it removes all the security roles.

Sometimes CRM admins can take away user roles from a user rather than disabling them.  The user won’t be able to do anything.   Remember a users security privileges can come from Team membership, not only their individual security roles.

If you want to learn more about users and security roles, read this brilliant article from CRM MVP Adam Vero

Security Roles and Teams in CRM – An Inconvenient Half-Truth

For a brief overview of security roles and business units

Business Units and Security Roles

a list of limitations and rules of CRM security read my exam notes

 

Creating the Advanced find

This advanced find was straight forward, I wanted to search the User entity for users who had security roles.

I selected user record, adding a condition to the security role where it contain data.

Advanced find users with security roles

Advanced find limitations

You cannot do Not in queries with advanced find.  If the requirement was to find all the users who didn’t have any security roles, this would have been impossible to do in advanced find.

Hopefully the Not query functionality will be added to Microsoft Dynamics CRM and the good news is there is a connect item we can vote up (it has over 600 votes)

Allow NOT IN searches in advanced find, marketing lists etc

The bad news is it has been an issue since 2011.  I have noticed a growing number of issues raised in connect, going through the channels Microsoft recommends and the issues not being fixed.

In the blog post Is Microsoft Listening to the Dynamics CRM Community? I suggest Microsoft should revamp the connect system and process so they can utilize the feedback generated by the CRM community to improve Microsoft Dynamics CRM.  At the moment I feel the Connect website and process is to slow and isn’t working.

If you need the functionality now I have seen two customizations you can try using

Building “Not In” Queries Using Dynamics CRM Advanced Find

Performing Outer Join in Advanced Find

 

 

 

 

CRM 2011 – an advanced find showing the phone calls for a campaign

I answered a forum post on this question but as I couldn’t upload a picture I thought I might as well add this as a blog post and upload the picture to the blog.

The user wanted to create a report of all the phone call activities for a campaign.  It was a little confusing because you couldn’t just filter on the phone call regarding field because the regarding field was linked to a campaign activity (and not the campaign).

So I linked to the campaign activity and then inside there I linked to the parent campaign

it is of course a lot easier if you just look at the screenshot below

CRM 2011 – How to delete a saved view

The functionality of CRM 2011 allows individuals to create personal views and save them.  This is very useful and doesn’t impact on anyone else, it’s one of the powerful tools and ideas in CRM 2011.

The one problem this can lead to is it’s easy to create views but then you can slowly start to get bogged down with views you don’t use.

but how do you delete them?

When looking at the menus and ribbons there doesn’t seem to be a logical place to find and delete your saved views.  To find the view and delete do this

1.  Open an advanced find

2.  Click the saved view button

3.  select a view

4.  press the delete saved view or Deactive if you think you might want to use it later

CRM 2011 – N:N relationships and advanced finds quirks

I was trying to set up a new entity and link it to a contact.

The example in this case was they wanted to have a Language Entity which they could add languages to a contact.  They would then want to search for contacts which had certain languages.

I set up my new language entity put a drop down on it with 5 languages to test with.

I initially created it as a 1:N relationship but this meant every language linked to a contact was a completely new language entity.  so you could have English for contact a and then a new language entity called English for contact b.  When you did an advanced search the two different values would appear.

So I went back and changed the relationship to N:N.

When you create an N:N relationship you get these choices below.  The display options are a bit unusual, do not display?

Although these options seem harmless the display option has big ramifications.  Luckily the CRM Guru Richard Knudson wrote a detailed blog about this which gave me the answer, which you can read here

 

Initially I chose to display the link on one side of the relationship, on the contact.  This caused advanced searches when searching a contact with languages of English to return no results.  Why?

The reason is if you do not display the relationship on both entities it won’t return any results in an advanced find!!!

Richard Knudson sums this up perfectly

Interestingly, it also turns out that if you select Do not Display in the relationship properties, you will not be able to create an Advanced Find query between two record types related with an N:N. So the Do not Display option apparently means “do not display in Advanced Find”, as well as “do not display on the form”.

 

Below I changed the display options this returned no rows, which perplexed me.

 

Another interesting point from the picture above is when you select multiple drop down values it selects those as an or, so I had to add another select to create the AND value I wanted.

Finally someone else in the office was saying this didn’t work in CRM 4 and I think this article from Richard Knudson again backs that up, saying there was something not quite right with N:N relationships and CRM 4

http://www.dynamicscrmtrickbag.com/2010/01/18/many-to-many-relationships/

once again thanks to the mighty Knud for that.

So there we go, once again CRM can act in unusual ways, which shows that experience using CRM is invaluable because the only way you  learn all these quirks is by trying things.