Walkthrough: Adding a new field to a data extension
The default data extension definitions include a number of predefined fields. If you want to add other fields to a Salesforce Marketing Cloud (SFMC) data extension, you can change the data extension definition in the tenant.
This walkthrough uses the example of adding a text field to the xDB Contact data extension, and describes how to:
-
Add a field to the tenant
-
Create a source value accessor
-
Create a target value accessor
-
Create a mapping between the value accessors
-
Update the data extension.
Add a field to the tenant
This example assumes you want to add a new attribute to the contact record. To do this, you must first define the new attribute by adding a new field to your tenant.
To add a field to your tenant:
-
In Sitecore, in the Content Editor, find your tenant and go to
Tenant Settings/Providers/SFMC/Object Definitions/Data Extensions/xDB Contact
. -
In the Insert menu, click Text. Enter a name for the field.
-
In the Required Settings section, fill in the following properties:
-
Length – the maximum length of the data in the field.
-
Name – a unique attribute key for accessing the attribute.
-
Type – the type of data the field contains.
-
-
In the Optional Settings section, fill in the following properties or leave them blank:
-
Default Value – enter a default value for the attribute.
-
Primary Key – make the attribute the primary key.
-
Required – make the attribute a required field.
-
-
Click Save.
Create a source value accessor
You must add a value accessor that can read the field value in xConnect.
To add a source value accessor:
-
Go to
Data Access/Value Accessor Sets/Providers/xConnect/Contact
. -
Right-click Contact and in the Insert menu, click xConnect Entity Facet Property Value Accessor.
-
Enter the item name and then click OK.
-
In the Settings section, in the Facet Property field, click the field that you want the accessor to connect to.
-
Click Save.
Create a target value accessor
You must add a value accessor that can update the field value in SFMC.
To add a target value accessor:
-
In your tenant, go to
Data Access/Value Accessor Sets/Providers/SFMC/Sitecore - xDB Contact
. -
Open the Insert menu. Click the Flat Object - Data Extension Template Field Value Accessor accessor.
NoteYou can also click the Flat Object - Value Accessor By Key accessor, but you must then manually maintain the field name, if it is changed in the data definition.
-
In the Settings section, in the Field field, click the field the accessor connects to.
-
Click Save.
Create a mapping between the value accessors
You must create a mapping between the source value accessor and the target value accessor.
To create a mapping:
-
In your tenant, go to
Value Mapping Sets/Sitecore - xConnect Contact To SFMC/xConnect Contact – To Flat Object
. -
In the Insert menu, click Value Mapping. Enter a name for the mapping.
-
In the Source Accessor field, select the value accessor that reads the value from xConnect.
-
In the Target Accessor field, select the value accessor that writes the value to SFMC.
-
Click Save.
Update the data extension
Finally, you must add the new field to the data extension in SFMC.
To add the field to the data extension, you can do one of the following two things:
-
Create the field manually in the data extension in SFMC.
-
Delete the data extension in SFMC and run the
Setup - SFMC Account Infrastructure
pipeline batch.ImportantIf you choose to delete the data extension, you must link the Sitecore data to the SFMC data extension again, as described in Walkthrough: Linking Sitecore data to the Salesforce data extensions.