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:

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

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. 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?