One of my posts that seems to remain in high demand, based on the site visitor analytics, is Advanced Queries with Advanced Find. Written over two years ago, people still tend to read it far more often than the newer posts dealing with the latest trends around Dynamics CRM or instructions on how to leverage other platform features like workflows and Business Process Flows. Thinking about the potential audience size, it’s of course understandable that a feature accessible to all CRM users will be much more popular than process configuration tools or the Dynamics product roadmap.
Although very few updates have been done on the Advanced Find functionality during the 10 years I’ve been using Dynamics CRM, it’s arguably still a real killer feature of the platform, at least when comparing it to the query capabilities of many similar business applications. The fact that you’re able to reference pretty much any related record in your query criteria (and in the CRM data model, absolutely everything is related) means that the tool can be used for building the most complex target group definitions for your marketing campaigns, for example, based on behavioral data stored many relationships away. You only have to use another Microsoft application to understand how powerful such a tool can be in the right hands.
It never hurts to have a good understanding of the CRM data model of your organization when launching Advanced Find to build some queries, since AF is a world of abundance when it comes to the available options to select from. Usually the relationships between records are something you can figure out from the end user UI if you spend a moment thinking about it – although with the “flat” design of CRM 2013+ menus and navigation structures, the front end ain’t as hierarchical in nature as the old popup-heavy UI used to be, thus sometimes leading you astray with the underlying data model. In some cases, though, Advanced Find will allow you to perform queries on entities that are completely invisible to the CRM end user. In this post we’ll take a look at one such entity, the activity party, and explore ways in which we can use it for providing the CRM users information on who they are interacting with.
Ain’t No Party Like The Activity Party…
…’Cause in the Activity Party everybody’s connected! OK, so what exactly is this “party” thing then? In the CRM user interface we have activities, which are divided into a number of different types, like email, appointment, phone call, letter, fax (everyone’s favorite default entity, right?) and potentially a selection of custom activity entities for non-standard communication channels like SMS or business specific record types for handling assignments, approvals and these types of work items. Each activity type shares a number of common fields that can be found from the entity called “activity”, which is what allows CRM to show this mixed bag of apples, oranges and pineapples in a single list of
fruit activities related to a business record like the customer account.
When we add people into an activity like a meeting invitation (remember: appointments are always invitations now in the server-side sync world, so be careful when including customer contacts there), CRM is not just populating a lookup field on the activity entity with the GUIDs of all the related users, contacts and other resources. What happens behind the scenes is that each of these related records will result in a new activity party record being created. This is an entity that you will not see in the CRM customization UI if you open the default solution. You can read about it in the SDK, or install a tool like the Metadata Browser (found inside the downloadable SDK package) and have a look at its contents from the live system, as we see below.
People who have been tasked to build SSRS reports that deal with activity records will have surely run into the ActivityParty table/view. If you’re interested in learning more about how the data is created and stored into the SQL database, go and read this great investigation by CRM MVP Aileen Gusni. If, on the other hand, you’d rather not spend too much time in Visual Studio / SQL Server Data Tools building reports but rather want to see how to leverage activity parties in Advanced Find, then this is the right article you’re reading right here.
View of “Activities Involving Me”
While activity parties are not accessible as a configurable entity in CRM (because ultimately they’re not), luckily they do exist in the Advanced Find UI. The first scenario in which we can take advantage of this capability is in building a view of activities that uses some criteria that’s not directly available on the activity record itself. Out of the box, CRM provides views like “My Activities” that show the records in which the current user is the owner (and which are open, even though the name of that default view is a bit misleading). Sure, it’s important to understand what’s on your To Do list right now, but sometimes it is beneficial to be able to reflect back a bit and see also what has happened in the past, to understand what you’ve spent your time on and who have you interacted with. For this, we’ll create a brand new view called “Activities Involving Me”.