Dynamics 365 — ActivityParty and ActivityParty Lists

Image for post
Image for post

Fools ignore complexity. Pragmatists suffer it. Some can avoid it. Geniuses remove it. Alan Perlis

Junior developers create code and complexity, senior developers remove code and simplify #HoskWisdom

The ActivityParty entity catches many new Dynamics 365 developers by surprise because it’s an entity inside an entity. This blog post looks at ActivityParty and some great resources to help you conquer it.

To spice up Dynamics development Microsoft likes to throw in a few special entities that have special powers. Microsoft have created great documentation but then littered it around so it’s hard to piece all the useful bits together.

There are special non standard entities lurking in CRM, this can catch out new developers because they are not standard, they can also annoy some people because we can’t make them

  • Customers (which can hold accounts and contacts)
  • ActivityParty (can hold any of the activity types)
  • regarding (can hold any object)
  • Owner — it can be a user or a team
  • Address entity, it’s half on the account, contact form but you can see it in advanced finds

I got an odd error once with ActivityParty and casting

The ActivityParty is complex record, its important to understand how it’s linked to Activities, Microsoft have some excellent documentation here


This picture quickly summaries ActivityParty

Richard Knudson has a great blog post on ActivityParties

First step go to the MDSN definition


An activity party represents a person or group associated with an activity. An activity can have multiple activity parties.

Where are party lists used? The most common area in Activity Party is used is the To and From on an email. The reason the ActivityParty is used is because an email can have multiple email addresses in the TO, CC (it’s a party of people)

Email is a easy way to understand not only how Activity Lists work but why we need them. The TO field on an email might contain multiple email addresses.

It also explains the name, each person on an email is an activity party and an activity party is a person or group.

As mentioned before an ActivityParty entity can hold many different entities, to see what type it is you need to check the Activity Party Type

Activity Party Types

There are 11 activity party types in Microsoft Dynamics 365. The different types are identified by the a different int value as shown below from MSDN documentation.

Image for post
Image for post

From the list above the ActivityParty is used with activities –

  • emails
  • appointments
  • phone calls
  • letters
  • faxes.

Not all of the Activity Party types can be used with all all the activities. e.g. appointments have Organizers, OptionalAttendee, RequiredAttendee but this wouldn’t work with emails.

The following table lists the activity party types that are supported for each activity, and the corresponding activity properties to specify those activity party types. ActivityParty entity

Image for post
Image for post
Image for post
Image for post

Reading a Resource

In this example I will be reading the resources value

ServiceAppointment.resources can hold multiple resources

the field value is IENumberable but I like to convert it into a list

List<ActivityParty> resources = (List<ActivityParty >)serviceAppointment.Resources.ToList();

On the front end resources can contains users or Facility/equipment. For those of you haven’t used the scheduling side of Microsoft (I only know about it because you are tested on it for the applications certification and it has been useful to understand how it works as potential customers have asked about it)

in my example, if want to display some details about the facilities/equipment and ignore people (they don’t have exciting details!)

So after capturing the resources in

The participationTypeMask = 10, which is a resource.

There are two guids, ID’s

  • ActivityPartyId
  • PartyId

The ActivityPartyID is the guid of the ActivityParty, the PartyID is the guid of the resource selected (e.g. user or facility/equipment).

In my code I want to check the PartyID, see if it’s a piece of equipment (not user) and if it is lookup the details for

For an in depth example go to

Sample: Work with activity party records

Some more useful information can be found in the links below

Written by

Have been working with Dynamics 365 since version 4 and enjoy reading and delivering enterprise projects

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store