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 Overview: Types of widgets and place it on a Pages: Structure functionality and appearance to display the field.

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:

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?