Microsoft Dynamics® CRM Training
Referencing Current Users with Advanced Find
An error occurred while loading the video. Please try again.
There are a number of lessons here in the Success Portal about Advanced Find in Microsoft Dynamics CRM. The basic mechanics of how to use the Advanced Find query designer are simple enough, like adjusting filters, editing columns, and saving results as Views. However, you could spend hours playing with Advanced Find and not scratch the surface of its capabilities, and you could easily get lost in its maze of menus and logic. The extendibility of Advanced Find is rather impressive.
Here is an example of how Advanced Find can go beyond a standard query. This query will present the current User with Account records they own, as well as records owned by fellow Users in their Business Unit. Thus, the query references the current User.
Let’s set up the scenario. Our organization supports several Business Units, and within each unit, Users generally work together on the same Accounts. Rather than restricting our Users’ access to only Accounts in their Business Unit, we want to give them access to all Account records in our organization. We do however want to provide Users with a View that shows them only Accounts owned by Users in their Business Unit, since these are the records they’ll be working with on a day-to-day basis. This way, they don’t have to sift through a large number of records to find the one they are looking for.
One solution is to create a View that shows Accounts owned by each User in the Business Unit. This is problematic though because it requires Users to toggle though a potentially long list of Views to find a record. What if the Business Unit had 40 Users? Do we create 40 Views?
Instead, we’ll build a View using query criteria with Advanced Find. Its underlying logic will be, “show all active Accounts where the related Owner is in a Business Unit that has a User that is me”. That’s not really a grammatically correct sentence, but it is how Advanced Find logic works. What it is basically saying is, “Show me all Account records whose owning User is in the same Business Unit as me”.
What’s great about this View is that not only will it be relevant to each individual User, but if I’m a member of multiple Business Units, it will show me Accounts all of those units in a single location. Basically, if I’m part of Business Unit “1” and “2”, but not “3”, this View will show me only Accounts owned by Users in “1” and “2”. If Jill xRM is only a member of Business Unit “3”, this View will only show her Accounts from “3”.
Now that we’ve discussed the logic, let’s build the query in Advanced Find. Navigate to Workplace > Customers > Accounts. In the ribbon, we’ll click Advanced Find. When it opens, select “[new]” in the Use Saved View field. Now, we have a clean slate and can begin setting the criteria.
First, we want to make sure the records are active, so we’ll set the first line to “Status, Equals, Active”. The next part of the logic is “…where the related Owner…” In the next line, select “Owning User (User)”, which is in the Related section of the dropdown. The next portion of logic is, “…is in a Business Unit…” In the next line of criteria, we’ll select “Business Unit”, which is also in the Related section of the dropdown. The last portion of logic is, “…that has a User that is me.” So in the next line we’ll select “Users (Business Unit)”, and immediately under we’ll set the line of criteria to “User Equals Current User”.
To clarify, let’s walk through each string of criteria, starting at the beginning. These will be Account records with a Status of “Active”. Out of those records, we want Accounts that are Owned by a User who is in the same Business Unit as the User that is currently logged in.
If we click Results in the ribbon, we should be presented with a list of records owned by the current User, and other Users in their Business Unit.
This is a useful query because it presents Users with contextual data relevant to them. It also helps us reduce the number of Views necessary to see the same information.
For more tips, tricks, and tutorials, please refer to the Success Portal and blog.xrm.com.