Create custom fields for subscribers

This article demonstrates way how to programmatically create a custom field for email subscribers. You can use this field as a custom field in the email campaign - for example, for title or country.

NOTE: By default, this field can not be accessed in the backend. If needed, you can create your own widget and place it on a page to display the field. For more information, see Develop widgets.

The example below creates two custom fields for subscribers - Title and Country.
First, create the fields in the database, by running the following code:

Then, fill out the fields by using the code bellow. The following sample fills the fields of all the subscribers with the same data:

The fields, created above, can be used in the Like a web page mail template the same way as the other dynamic fields - {|Subscriber.Title|} and {|Subscriber.Country|}

The complete method for getting the fields' values looks like this:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?