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:
Title
Country
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|}
{|Subscriber.Title|}
{|Subscriber.Country|}
The complete method for getting the fields' values looks like this:
Sign up for our free beginner training. Boost your credentials through advanced courses and certification. Register for Sitefinity training and certification.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important