Use core collection model facets
xConnect defines a number of built-in facets. These facets are located in the Sitecore.XConnect.Collection.Model namespace.
Referencing the core collection model
Referencing the core collection model
The following example demonstrates how to reference the Sitecore.XConnect.Collection.Model.CollectionModel.Model in your own model:
Using core collection model facets
Using core collection model facets
To work with facets within the core collection model, use the default facet keys as shown:
All built-in facets have a default facet key that is represented by a DefaultFacetKey property - for example, PersonalInformation.DefaultFacetKey.
Contact facets
Contact facets
PersonalInformation (PersonalInformation)
The PersonalInformation facet does not have any mandatory properties.
You can also use the .SetPersonal() extension on the client:
EmailAddressList
The preferred email is not included in the .Others list.
You can also use the .SetEmails() extension on the client:
AddressList
The preferred address is not listed in .Others.
You can also use the .SetAddresses() extension on the client:
PhoneNumberList
The preferred phone number is not included in the Others list.
You can also use the .SetPhoneNumbers() extension on the client:
ConsentInformation
The ConsentInformation facet changed in Sitecore 10.0.
The following example shows how to populate an instance of the ConsentInformation facet class and add two consent items to the dictionary - one for the default site (website) and one for a custom site (subsite):
EXM provides extension methods to read and change the doNotMarket and consentRevoked values:
You can also use the .SetConsentInformation() extension on the client:
ListSubscriptions
You can use the .SetListSubscriptions() extension on the client to set this facet:
Getting contact list definitions
Each ContactListSubscription stores the list ID. If you want to access details about the list (such as the list name), use the contact list definition manager (this is part of the Marketing Operations API).
AutomationPlanEnrollmentCache
The AutomationPlanEnrollmentCache contains a contact’s current automation plan enrollments, including the activity they are enrolled in. This facet is set by the Automation Engine whenever a contact is enrolled in a new plan or activity.
Do not set this facet manually. It is updated by the Marketing Automation Operations API.
To retrieve this facet:
Get plan and activity definitions
Each AutomationPlanEnrollment stores the activity ID and plan ID. If you want to access details about the plan or activity (such as names), use the automation plan definition manager (this is part of the Marketing Operations API).
Avatar
To retrieve this facet:
You can also use the .SetAvatar() extension on the client:
Calculated contact facets
Calculated contact facets
The following calculated contact facets are available by default:
You should never set the value of calculated facets - they are set by a service plugin each time an interaction is submitted to xConnect.
Interaction facets
Interaction facets
UserAgentInfo
IpInfo
To retrieve this facet:
You can also use the .SetIpInfo() extension on the client:
ProfileScores
WebVisit
The WebVisit facet stores information about an interaction that occurred on a website. In a Sitecore context, this facet is populated by the tracker on session end. The following example demonstrates how to imitate a web visit by setting the WebVisit facet and adding a number of PageViewEvent events to the interaction:
LocaleInfo
You can also use the .SetLocaleInfo() extension on the client:
Facet get/set extension methods
Facet get/set extension methods
Add usingSitecore.XConnect.Collection.Model to your class to access a number of extension methods for contacts, interactions, and the xConnect client that make it easier to get and set built-in facets. For example, myContact.Personal() calls the following method:
Similarly, client.SetAddresses(myContactObject,myFacetObject) calls the following method: