Set contact facets
Use the client.SetFacet() method to create or update a contact facet.
When you use a default facet value, the value isn't stored in the shard databases (xDB). Instead, the default value is populated when the facet is retrieved using xConnect. Examples of default values include false for a Boolean field, and 0 for an int32 type field.
Keep the following in mind when updating an existing contact’s facets:
-
If you are updating an existing facet on an existing contact, you request that facet as part of the
ContactExpandOptions -
If you are setting a facet for the first time on an existing contact, you do not need to request that facet as part of the
ContactExpandOptions -
To update a contact facet that has already been set, you must retrieve the existing facet object and set individual properties - overwriting the entire facet or setting it to null will result in an exception
Facets are available in the contact’s Facets collection immediately after SubmitAsync() / Submit() succeeds.
Set a new facet on a new contact
In the following example, three facets are added to a new contact. The example demonstrates how to use each of the client.SetFacet() overloads.
Set a new facet on an existing contact
The following example demonstrates how to set the PersonalInformation facet on an existing contact. In this example, the contact does not yet have a PersonalInformation facet.
Update an existing facet on an existing contact
The following example demonstrates how to update an existing facet on an existing contact.