Create a Custom Profile Center with AMPscript

This page contains information about creating a custom Profile Center for Email Studio’s Web Collect that takes information entered on a web page and uses it to update information in your account. This Profile Center also triggers a send using information taken from Marketing Cloud Engagement.

Web Collect Overview 

Email Studio’s Web Collect allows your customers to subscribe, provide attribute information, or unsubscribe using forms on your website.

If you allow new subscribers to sign up via your website, you must pass data for all required profile and preference attributes, including those that are defined as hidden, for each new subscriber.

Profile Center Overview 

The Email Studio Profile Center displays when a subscriber clicks the Modify Profile link in an email that you sent while using Email Studio.

To access your Profile Center, navigate to the Subscribers | Profile Management section of Email Studio and choose Preview Profile Center. The Profile Center displays all attributes that aren’t defined as hidden in your account.

What Is a Custom Profile Center? 

The custom profile center includes a workflow specifically designed and developed to take information submitted by a new or existing subscriber and update records accordingly. Because it is a custom solution, you can create it to perform specific actions depending on your needs and your workflow.

Why Create a Custom Profile Center Using AMPscript and SOAP API? 

Your custom profile center allows you to manage information in your account and use that information to conduct triggered sends as confirmation of more or changed information in a particular profile. The automation allows the user to keep their information up to date without involving more effort from your team. This profile center also allows you to review tracking information inside Marketing Cloud Engagement for analysis and appropriate action.

Possible Use Case 

Northern Trail Outfitters uses Marketing Cloud Engagement to manage information about their subscribers and conduct triggered sends regarding information changes to those subscribers. To help customers manage their information, Northern Trail Outfitters builds a custom profile center that takes information from a web form and either creates a new subscriber record or updates an existing record. That change triggers an email that includes the appropriate dynamic form information for that record and sends it to the new or existing subscriber.

To set up the triggered sends:

  1. Download the files via the link on this page, or copy and paste the examples below.
  2. Edit the AMPscript to customize the variables for your server, configuration, and subscribers.
  3. Put these edited pages in the correct folder of your local web server (where your Web Collect page is running) that can access the server and also access the SOAP API endpoint. Review the next sections for more details. For more help with your setup, contact Salesforce Customer Support.

How to Create a Custom Profile Center Using AMPscript and SOAP API 

The custom profile center includes several components.

  • A web form used to interact with new and existing subscribers.
  • The code necessary to make API calls.
  • An administrative page used to determine the information that shows in the profile center.
  • The email message used to communicate profile changes to the subscriber.
  • The triggered send definition used to send the email message.

How to Create the Web Form 

Use this code example as a template for building your own web form.

1%%[
2
3  /* Get the Id of the account */
4  Set @mid = [memberid]
5  /* Get the key from the form */
6  Set @subKey = [_subscriberkey]
7
8  if Empty(@subKey) or  @subKey == "" then
9   SET @subKey = "subkey@example.com"
10  endif
11
12  /* Create the subscriber's object */
13  set @subscriber = CreateObject( "Subscriber" )
14  SetObjectProperty( @subscriber, "EmailAddress", @subKey )
15  SetObjectProperty( @subscriber, "SubscriberKey", @subKey )
16
17  /* make sure the system is posting */
18  SET @isUpdate = RequestParameter("personal")
19
20  SET @save = "FALSE"
21  if Not Empty(@isUpdate) then
22
23   SET @save = "TRUE"
24   /* get the attributes and checkBoxes */
25   SET @checkBoxes = RequestParameter("checkBoxList")
26   SET @attributes = RequestParameter("attributes")
27
28   /* Create arrays from each of the lists */
29   SET @checkArray = BuildRowSetFromString(@checkBoxes,"||")
30   SET @attArray = BuildRowSetFromString(@attributes,"||")
31   SET @attCount = RowCount(@attArray)
32   SET @checkCount = RowCount(@checkArray)
33   SET @display = ""
34   SET @display2 = ""
35   if @attCount > 0 then
36    /* iterate all of the elements */
37    FOR @i = 1 TO @attCount DO
38
39     Set @attribute = Field(Row(@attArray, @i),1)
40
41     Set @value = RequestParameter(@attribute)
42
43     /* Create the Attribute */
44     Set @att = CreateObject( "Attribute" )
45     SetObjectProperty( @att, "Name", @attribute )
46     SetObjectProperty( @att, "Value", @value )
47
48     /* Set the attribute to the subscriber */
49     AddObjectArrayItem( @subscriber, "Attributes", @att )
50
51     /*
52     Set @display = Concat(@display,@attribute, " = " , @value, " @@@ ")
53     */
54    NEXT @i
55   endif
56
57   /*
58   Set @display = Concat(@display," ---CHECK --- ")
59   */
60
61   if @checkCount > 0 then
62    /* iterate all of the elements */
63    FOR @i = 1 TO @checkCount DO
64
65     set @values = ""
66
67     Set @attribute = Field(Row(@checkArray, @i),1)
68
69     Set @internalCheckArray = BuildRowSetFromString(@attribute,":")
70
71     if RowCount(@internalCheckArray) > 1 then
72      SET @checkName = Field(Row(@internalCheckArray, 1),1)
73
74      SET @checkNumber = Field(Row(@internalCheckArray, 2),1)
75
76      FOR @j = @checkNumber DOWNTO 1 DO
77
78       Set @singleCheckName = Concat(@checkName,@j)
79       Set @value = RequestParameter(@singleCheckName)
80
81       IF not Empty(@value) then
82
83        if(Empty(@values))then
84         set @values = @value
85        else
86         set @values = Concat(@values, ",", @value )
87        endif
88
89       endif
90
91
92      NEXT @j
93
94      /* Create the Attribute */
95      Set @apiName = Replace(@checkName,"-"," ")
96      Set @att = CreateObject( "Attribute" )
97      SetObjectProperty( @att, "Name", @apiName )
98      SetObjectProperty( @att, "Value", @values )
99      /* Set the attribute to the subscriber */
100      AddObjectArrayItem( @subscriber, "Attributes", @att )
101
102      /*
103      Set @display = Concat(@display,@apiName, " = " , @values, " @@@ ")
104      */
105     endif
106    NEXT @i
107   endif
108  endif
109
110  /* Did the user press the subscriptions submit button */
111  if RequestParameter("subscription") == 1 then
112
113   SET @save = "TRUE"
114   /* request paramter from List A */
115   Set @theListA = RequestParameter("ListsA")
116   Set @array = BuildRowSetFromString(@theListA, '|')
117
118   for @r = 1 to Rowcount(@array) do
119    Set @configRow = Row(@array,@r)
120    Set @configkey = Field(@configRow,1)
121
122    Set @value = RequestParameter(@configkey)
123
124    if Empty(@value) then
125
126     set @subscription = CreateObject("SubscriberList")
127     SetObjectProperty( @subscription, "ID", @configkey )
128     SetObjectProperty( @subscription, "IDSpecified", "true" )
129     SetObjectProperty( @subscription, "Status", "Unsubscribed" )
130     SetObjectProperty( @subscription, "StatusSpecified", "true" )
131     AddObjectArrayItem( @subscriber, "Lists", @subscription )
132    else
133     set @subscription = CreateObject("SubscriberList")
134     SetObjectProperty( @subscription, "ID", @configkey )
135     SetObjectProperty( @subscription, "IDSpecified", "true" )
136     SetObjectProperty( @subscription, "Status", "Active" )
137     SetObjectProperty( @subscription, "StatusSpecified", "true" )
138     AddObjectArrayItem( @subscriber, "Lists", @subscription )
139    endif
140
141   next @r
142
143   /* request paramter from List U */
144   Set @theListU = RequestParameter("ListsU")
145   Set @array = BuildRowSetFromString(@theListU, '|')
146
147   for @r = 1 to Rowcount(@array) do
148    Set @configRow = Row(@array,@r)
149    Set @configkey = Field(@configRow,1)
150
151    Set @value = RequestParameter(@configkey)
152
153    if @value == "Active" then
154
155     set @subscription = CreateObject("SubscriberList")
156     SetObjectProperty( @subscription, "ID", @configkey )
157     SetObjectProperty( @subscription, "IDSpecified", "true" )
158     SetObjectProperty( @subscription, "Status", "Active" )
159     SetObjectProperty( @subscription, "Action", "create" )
160     AddObjectArrayItem( @subscriber, "Lists", @subscription )
161    endif
162   next @r
163  endif
164
165  /* Did the user press the Unsub Allbutton */
166  if RequestParameter("subscriptionALL") == 1 then
167
168   SET @save = "TRUE"
169   if RequestParameter("UnsubAll") == "true" then
170    SetObjectProperty( @subscriber, "Status", "Unsubscribed" )
171   else
172    SET @error = "True"
173    set @message = "Please Select One of the Options"
174    endif
175  endif
176
177  /* SET @display3 = "" */
178  /* Did the user change their preferernces */
179  if RequestParameter("preference") == 1 then
180
181   SET @save = "TRUE"
182   Set @ppr = RequestParameter("preferences")
183   Set @array = BuildRowSetFromString(@ppr, '|')
184   /* SET @display3 = Concat(@array,"@@@@@@@@@") */
185   for @r = 1 to Rowcount(@array) do
186    Set @configRow = Row(@array,@r)
187    Set @configkey = Field(@configRow,1)
188
189    Set @value = RequestParameter(@configkey)
190
191     if @configKey == "EmailTypePreference" then
192
193      if @value == "true" then
194       SetObjectProperty( @subscriber, "EmailTypePreference", "HTML" )
195      else
196       SetObjectProperty( @subscriber, "EmailTypePreference", "TEXT" )
197      endif
198
199     else
200
201      if @value == "true" then
202       Set @value = "True"
203      else
204       Set @value = "False"
205      endif
206
207      set @pref = CreateObject( "Attribute" )
208      SetObjectProperty( @pref, "Name", @configkey )
209      SetObjectProperty( @pref, "Value", @value )
210      AddObjectArrayItem( @subscriber, "Attributes", @pref )
211
212     endIf
213
214   next @r
215  endif
216
217  IF @save == "TRUE" then
218   /* change the last modify date */
219   SET @theTime = Format(Now(), "MM/dd/yyyy")
220   set @LastModify = CreateObject( "Attribute" )
221   SetObjectProperty( @LastModify, "Name", "Last Modify" )
222   SetObjectProperty( @LastModify, "Value", @theTime )
223   AddObjectArrayItem( @subscriber, "Attributes", @LastModify )
224
225   /* Update the Subscriber If we have to */
226   var @createOpts, @saveOpt
227
228   /* Create the save option */
229   set @saveOpt = CreateObject("SaveOption")
230    SetObjectProperty( @saveOpt, "SaveAction", "UpdateAdd" )
231    SetObjectProperty( @saveOpt, "PropertyName", "*" )
232
233   /* Specify the Update option */
234   set @createOpts = CreateObject("CreateOptions")
235    AddObjectArrayItem( @createOpts, "SaveOptions", @saveOpt )
236
237   /* Update the subscriber */
238   set @createStatusCode = InvokeCreate( @subscriber, @createErrDesc, @createErrNo, @createOpts )
239
240   /* If we failed to create the subscriber, output the information as the top level error */
241   if @createStatusCode != "OK" then
242    Redirect("http://%%microsite_base_url[default]3891541[/default]%%")
243   else
244    SET @TheWorks = 'true'
245   endif
246  endif
247
248]%%

This section retrieves information from data extensions for display.

1%%[
2      /* get the values from the DE */
3      Set @tableValues = LOOKUPORDEREDROWS("adminPageInfo",0,"Order asc", "SecretField", "1")
4
5      /* get the count of the elements */
6      Set @theRowCount = RowCount( @tableValues )
7
8      /*
9       Counters for the number of columns and number of elements in a group
10      */
11      Set @counter = 0
12      Set @idCounter = 1
13
14      /*
15       List that contains the name of all the elements that we
16       need to retrieve when the user tries to save
17      */
18      Set @AttributeList = ""
19      Set @checkBoxList = ""
20      Set @radioList = ""
21
22
23      /* for all the variables */
24      FOR @Variable = 1 TO @theRowCount DO
25
26       /* get each of the rows */
27       Set @table1 = Row( @tableValues, @Variable )
28
29       /* get the previous parameters except the first one */
30       if not @Variable == 1 then
31        Set @table2 = Row( @tableValues, Subtract(@Variable,1) )
32       endif
33
34       /* get all the varaibles we need */
35       Set @order = Field( @table1, "Order" )
36       Set @name = Field( @table1, "Name" )
37       Set @at = Field( @table1, "Attribute Value")
38       Set @dt = Field( @table1, "Data Type" )
39       Set @ev  = Field( @table1, "Element Value" )
40       Set @group = Field( @table1, "Group" )
41       Set @groupName = Field( @table1, "Group Name" )
42       Set @limit = Field(@table1, "Limit")
43       Set @column = Field(@table1, "Column")
44       Set @required = Field(@table1,"Required")
45       Set @readOnly = Field(@table1, "Read Only")
46       Set @key = Field( @table1, "key" )
47
48       /*
49        make sure that the fields can be used as IDs (i.e. replace the white space with -)
50       */
51       set @cleanID = Replace(@name," ","-")
52       set @cleanDt = Replace(@dt," ","-")
53       Set @cleanGroup = Replace(@group," ","-")
54
55       /* get the name of the previous varaible */
56       if not empty(@table2) then
57        Set @group2 = Field( @table2, "Group" )
58        Set @dt2 = Field( @table2, "Data Type" )
59        Set @name2 = Field( @table2, "Name" )
60       endif
61
62
63       /*
64        If the Groups are different and the names are different.
65        There is a similar check later on, but this one makes sure it
66        happens before displaying the group headers
67       */
68       if @group != @group2 and @name != @name2 then
69
70        /*
71         If the type of the previous Group was the Drop Down
72         we need to close the select tag
73        */
74        if @dt2 == "Drop Down" then
75        ]%%
76         </select> </div>
77        %%[
78        endif
79       endif
80
81       /*
82        If the groups are different and there is a group name (i.e. NO Text related fields)
83       */
84       if @group != @group2  and NOT Empty(@groupName) then
85
86        /*
87         If there is no fields or the limit is not 0, we are going to create
88         a dynamic call to a javascript function to make sure the limits are met.
89        */
90        if Not Empty(@limit) and @limit !=0 then
91
92         Set @call = Concat(@cleanGroup,",", @limit)
93
94         if not Empty(@tocall) then
95          Set @tocall = Concat(@tocall,"|" , @call)
96         else
97          Set @tocall =  @call
98         endif
99
100        endif
101
102        /*
103         If the type is a drop-down or a Radio we need to save all the names
104         in the list by just concatinating them with a comma
105        */
106        if @dt == "Radio" OR @dt == "Drop Down" then
107
108         if @readOnly != true then
109          Set @AttributeList = Concat(@AttributeList,"||",@name)
110         endif
111        /*
112         If the type is a check box we need to concatenate them with a pipe
113         So we can then append all the values and save them in ONE field
114        */
115        endif
116
117        /*
118         Set the counter to 0 and then the counter of the columns to the number
119         Of colums that we need to display. When these two numbers are the same
120         we need to diplay the elements in the next page
121        */
122        Set @counter = 0
123        Set @columnNum = @column
124
125        /*
126         ID used to display an error when the user selects too many options,
127         or a required field is not filled. The option is always in the
128         page, but hidden. It is dynamic because we only need the
129         group name and the rest is just appended
130        */
131        Set @theErrorID = Concat(@cleanGroup,"error")
132        Set @requiredID = Concat(@cleanGroup,"required")
133
134
135
136        /*
137         Div that solved the problems related to the floating Divs
138        */
139        ]%%
140         <div class="theClear"> </div>
141        %%[
142
143        /*
144         If the previous element was not an input field or a drop-down menu,
145         display a break before the group header
146        */
147        if @dt2 != "Input Field" and @dt2 != "Drop Down" then
148        ]%%
149         <br/>
150        %%[
151        endif
152
153        ]%%
154         <span class="group%%=v(@cleanDt)=%%">
155        %%[
156        /* If the element is required display the red * */
157        if @required == true then
158        Set @requiredFields = Concat(@requiredFields,"|",@cleanID)
159        ]%%
160         <span id="theRequiredGroup"> * </span>
161        %%[
162        else
163        ]%%
164         <span id="theRequired">&nbsp;&nbsp;</span>
165        %%[
166        endif
167        /*
168         Display the group header and the error code for too many selections
169        */
170        ]%%
171         <b> %%=v(@groupName)=%% </b> <span id="%%=v(@theErrorID)=%%" class="theError"> Too many selections (MAX %%=v(@limit)=%%)</span>
172        %%[
173
174        /*
175         If the element is required then set a hidden message that we can show when there is an error.
176        */
177        if @required == true then
178        ]%%
179         <span id="%%=v(@requiredID)=%%" class="theError"> This Field is required </span></span>
180        %%[
181        else
182        ]%%
183         </span>
184        %%[
185        endif
186
187        /*
188         If the element is not a drop-down, we need to create a space between the header and the field
189        */
190        if @dt != "Drop Down" then
191        ]%%
192         <br/>
193        %%[
194        endif
195
196        if @dt == "CheckBox" then
197        ]%%
198         <input id="%%=v(@cleanID)=%%" type='checkbox' newId="%%=v(@cleanID)=%%"style="display:none;"/>
199
200        %%[
201        endif
202
203       else
204        Set @counter = Add(@counter, 1)
205        Set @theTest = Concat(@theTest, " " , @ev)
206
207       endif
208
209       /*
210        If the groups are different and the names are also different
211        That means that we have change the element
212       */
213       if @group != @group2 and @name != @name2 then
214
215        /* if the data type is a dropDown we need to open the drop
216         Down Tag
217        */
218        if @dt == "Drop Down" then
219        ]%%
220         <div class="theDropdown">
221         <select class="theSelect" id="%%=v(@cleanID)=%%" newId="%%=v(@cleanID)=%%" name="%%=v(@name)=%%" >
222        %%[
223        endif
224
225        if @dt2 == "CheckBox" then
226
227         /* Clean the name of the group to be used on and id */
228         Set @thegroup2 = Replace(@group2," ","-")
229         /* Get the counter and reduce it by one */
230         Set @boxCounter = Subtract(@idCounter,1)
231         /* if the Counter was one, then set it back to 1 */
232         if @boxCounter == 0 then
233          Set @boxCounter = 1
234         endif
235         /* Set the name and the counter into the list */
236         Set @checkBoxList = Concat(@checkBoxList,@thegroup2,":",@boxCounter,"||")
237
238
239        endif
240
241        /*
242         Reset the Group Id Counter when the group changes
243        */
244
245        Set @idCounter = 1
246
247       endif
248
249       /* make the disable value */
250       if @readOnly == true then
251        SET @disable = "disabled='true'"
252       else
253        SET @disable = ""
254       endif
255       /*
256        If the data type is a checkbox we need to test if
257        we have reached the number of columns. If so,
258        we need to create a break to continue in the next row
259       */
260
261       if @dt == "CheckBox" then
262
263        if @counter == @columnNum then
264         ]%%
265          </br>
266         %%[
267         Set @counter = 0
268        endif
269
270        /*
271         Create a set of ids, so all the elements in the group have the same name
272         but a different number at the end. This gets all the elements of
273         a group just by knowing the type and the name
274        */
275        Set @theID = Concat(@group,@idCounter)
276        Set @theID = Replace(@theID," ","-")
277        Set @idCounter = add(@idCounter, 1)
278        ]%%
279
280         <div class="theColumn%%=v(@columnNum)=%%">
281         <input id="%%=v(@theID)=%%" type='checkbox' name='%%=v(@theID)=%%' %%=v(@disable )=%% newId="%%=v(@at)=%%" value="%%=v(@at)=%%" class="theCheckbox"/>
282         <span class="checkLabel"> %%=v(@at)=%% </span>
283         </div>
284        %%[
285
286       /*
287        If the input type is input field we display the name and then create the input.
288        Also, we need to display the * before the name if required.
289       */
290       elseif @dt == "Input Field" then
291
292        /* add the attribute to the list of elements to enter in the system */
293        if @readOnly != true then
294         Set @AttributeList = Concat(@AttributeList,"||",@name)
295        endif
296
297        Set @requiredID = Concat(@cleanID,"required")
298
299        ]%%
300         <div class="inputDiv">
301        %%[
302         /* If its required display the red * */
303         if @required == true then
304          Set @requiredFields = Concat(@requiredFields,"|",@cleanID)
305         ]%%
306
307          <span id="theRequired"> * </span>
308         %%[
309         else
310         ]%%
311          <span id="theRequired">&nbsp;&nbsp;</span>
312         %%[
313         endif
314
315        ]%%
316         <label class="theLabel">%%=v(@name)=%%: </label>
317         <input type='text' id='%%=v(@cleanID)=%%' %%=v(@disable )=%% name='%%=v(@name)=%%' newId="%%=v(@cleanID)=%%" class="theInputField"/>
318         <span id="%%=v(@requiredID)=%%" class="inputEror"> This Field is required </span></span>
319         </div>
320        %%[
321
322       /*
323        If it is a radio button data type, we just need to display the name and then the option
324       */
325       elseif @dt == "Radio" then
326
327        ]%%
328         <div class="inputRadio">
329         <input type="radio" %%=v(@disable )=%% name='%%=v(@name)=%%' newId="%%=v(@cleanID)=%%" value="%%=v(@ev)=%%" class="theRadio"> %%=v(@at)=%%  <br/>
330         </div>
331        %%[
332
333       /* If it is a text area just display the name and then the text area */
334       elseif @dt == "Text Area" then
335
336        /* add the attribute name to the List */
337        if @readOnly != true then
338         Set @AttributeList = Concat(@AttributeList,"||",@name)
339        endif
340
341        Set @requiredID = Concat(@cleanID,"required")
342
343        ]%%
344         <div class="theTextAreaDiv">
345        %%[
346        /* If its required display the red * */
347        if @required == true then
348         Set @requiredFields = Concat(@requiredFields,"|",@cleanID)
349        ]%%
350
351         <span id="theRequired"> * </span>
352        %%[
353        else
354        ]%%
355         <span id="theRequired">&nbsp;&nbsp;</span>
356        %%[
357        endif
358        ]%%
359          <label class="theLabel">%%=v(@name)=%% : </label> <span id="%%=v(@requiredID)=%%" class="inputEror"> This Field is required </span></span></br>
360          <textarea rows="2"  %%=v(@disable )=%% cols="20" id='%%=v(@cleanID)=%%' newId="%%=v(@cleanID)=%%" name="%%=v(@name)=%%" value="%%=v(@ev)=%%" class="theTextArea"> </textarea> <br/>
361         </div>
362        %%[
363
364       /*
365        if it is a drop-down then we display only the option.
366        The open and close tags are done elsewhere.
367       */
368       elseif @dt == "Drop Down" then
369
370        ]%%
371         <option %%=v(@disable )=%% value="%%=v(@at)=%%"> %%=v(@at)=%% </option>
372        %%[
373
374       endif
375
376      NEXT @Variable
377
378      /* Clean the name of the group to be used on an id */
379      Set @thegroup2 = Replace(@group," ","-")
380
381      IF IndexOf(@checkBoxList, @thegroup2 ) == 0 and @dt == "CheckBox" then
382
383       /* Get the counter and reduce it by one */
384       Set @boxCounter = Subtract(@idCounter,1)
385       /* if the Counter was one, then set it back to 1 */
386       if @boxCounter == 0 then
387        Set @boxCounter = 1
388       endif
389       /* Set the name and the counter into the list */
390       Set @checkBoxList = Concat(@checkBoxList,@thegroup2,":",@boxCounter,"||")
391      endif
392
393      SET @len = Length(@requiredFields)
394      Set @requiredFields = Substring(@requiredFields,1,@len)
395
396      SET @toCall = Concat(@toCall,"@@",@requiredFields)
397      /* Set up the Call */
398      Set @toCall = Concat("areLimitsInOrder('",@toCall,"');")
399     ]%%

This section retrieves the list to be modified as part of the activity in the profile center.

1%%[
2        /* Find Out the status of the subscribers */
3        SET @rr4 = CreateObject("RetrieveRequest")
4        SetObjectProperty(@rr4,"ObjectType","ListSubscriber")
5        AddObjectArrayItem(@rr4, "Properties", "Status")
6        AddObjectArrayItem(@rr4, "Properties", "ListID")
7
8        /* Make sure that the list is public */
9        SET @sfp2 = CreateObject("SimpleFilterPart")
10        SetObjectProperty(@sfp2,"Property","SubscriberKey")
11        SetObjectProperty(@sfp2,"SimpleOperator","equals")
12        AddObjectArrayItem(@sfp2,"Value",@subKey)
13        /* set the filter to the request */
14        SetObjectProperty(@rr4,"Filter",@sfp2)
15        SET @listStatus = InvokeRetrieve(@rr4, @status)
16        /* Create the Request for the list */
17        SET @rr3 = CreateObject("RetrieveRequest")
18        SetObjectProperty(@rr3,"ObjectType","List")
19        AddObjectArrayItem(@rr3, "Properties", "ListName")
20        AddObjectArrayItem(@rr3, "Properties", "Type")
21        AddObjectArrayItem(@rr3, "Properties", "Description")
22        AddObjectArrayItem(@rr3, "Properties", "ID")
23
24        /* Make sure that the list is public */
25        SET @sfp2 = CreateObject("SimpleFilterPart")
26        SetObjectProperty(@sfp2,"Property","Type")
27        SetObjectProperty(@sfp2,"SimpleOperator","equals")
28        AddObjectArrayItem(@sfp2,"Value","public")
29
30        /* Make sure that the list is not a publication list */
31        SET @sfp3 = CreateObject("SimpleFilterPart")
32        SetObjectProperty(@sfp3,"Property","ListClassification")
33        SetObjectProperty(@sfp3,"SimpleOperator","equals")
34        AddObjectArrayItem(@sfp3,"Value","ExactTargetList")
35
36        /* set the complex filter */
37        Set @cf1 = CreateObject("ComplexFilterPart")
38        SetObjectProperty(@cf1,"LeftOperand",@sfp2)
39        SetObjectProperty(@cf1,"RightOperand",@sfp3)
40        SetObjectProperty(@cf1,"LogicalOperator","AND")
41        /* set the filter to the request */
42        SetObjectProperty(@rr3,"Filter",@cf1)
43        SET @atts = InvokeRetrieve(@rr3, @status)
44
45        /* String to store all the list ids */
46        SET @ListsA = ""
47        SET @ListsU = ""
48        Set @lA = 1
49        Set @lU = 1
50
51        /* make sure that lists are present */
52        IF RowCount(@atts) > 0 THEN
53
54         /* For all of the present lists, take the following actions */
55         FOR @c = 1 TO RowCount(@atts) DO
56
57          /* get each of the rows */
58          SET @lis = Row(@atts,@c)
59
60          /* get the necesary variables */
61          SET @lis_name = Field(@lis,'ListName')
62          SET @lis_ID = Field(@lis,'ID')
63          SET @lis_des = Field(@lis,'Description')
64
65          Set @printed = false
66          /* Find the status of the public list */
67          IF RowCount(@listStatus) > 0 THEN
68
69           /* for all the status of the list */
70           FOR @d = 1 TO RowCount(@listStatus) DO
71
72            SET @lisStat = Row(@listStatus,@d)
73            SET @lisStat_id = Field(@lisStat,'ListID')
74            SET @lis_status = Field(@lisStat,'Status')
75
76            if @lisStat_id == @lis_ID and @lis_status == 'Active' then
77            ]%%
78             <input type='checkbox' name='%%=v(@lis_ID)=%%' value='Active' checked="checked" /> %%=v(@lis_name)=%% <br />
79             <small> %%=v(@lis_des)=%% </small><br/><br/>
80            %%[
81             /* create the array of Active list ids */
82             if @lA == 1 then
83              SET @ListsA = @lis_ID
84              SET @lA = 2
85             else
86              SET @ListsA = Concat(@ListsA, "|" , @lis_ID)
87             endif
88
89             Set @printed = true
90
91            elseif @lisStat_id == @lis_ID and @lis_status == 'Unsubscribed' then
92            ]%%
93             <input type='checkbox' name='%%=v(@lis_ID)=%%' value='Active'/> %%=v(@lis_name)=%% <br />
94             <small> %%=v(@lis_des)=%% </small><br/><br/>
95            %%[
96             /* create the array of Active list ids */
97             if @lA == 1 then
98              SET @ListsA = @lis_ID
99              SET @lA = 2
100             else
101              SET @ListsA = Concat(@ListsA, "|" , @lis_ID)
102             endif
103
104             Set @printed = true
105
106            endif
107
108           NEXT @d
109          ENDIF
110          IF @printed == false then
111           ]%%
112            <input type='checkbox' name='%%=v(@lis_ID)=%%' value='Active'/> %%=v(@lis_name)=%% <br />
113            <small> %%=v(@lis_des)=%% </small><br/>
114           %%[
115
116           /* create the array of Non Active list ids */
117            if @lD== 1 then
118             SET @ListsU = @lis_ID
119             SET @lD = 2
120            else
121             SET @ListsU = Concat(@ListsU, "|" , @lis_ID)
122            endif
123          endif
124
125         NEXT @c
126        endif
127        ]%%
1%%[
2        /* List that stores all the preferences */
3        var @preferences
4        SET @preferences = "EmailTypePreference"
5
6        /* Get all the subscriber attributes */
7        SET @rr2 = CreateObject("RetrieveRequest")
8        SetObjectProperty(@rr2,"ObjectType","Subscriber")
9        AddObjectArrayItem(@rr2, "Properties", "ID")
10        AddObjectArrayItem(@rr2, "Properties", "EmailTypePreference")
11        AddObjectArrayItem(@rr2, "Properties", "EmailAddress")
12        AddObjectArrayItem(@rr2, "Properties", "SubscriberKey")
13        AddObjectArrayItem(@rr2, "Properties", "Status")
14
15        /* Create a filter be the subscriber Id */
16        SET @sfp2 = CreateObject("SimpleFilterPart")
17        SetObjectProperty(@sfp2,"Property","SubscriberKey")
18        SetObjectProperty(@sfp2,"SimpleOperator","equals")
19        AddObjectArrayItem(@sfp2,"Value",@subKey)
20        /* invoke the Retrieve Call */
21        SetObjectProperty(@rr2,"Filter",@sfp2)
22        SET @atts = InvokeRetrieve(@rr2,@status)
23
24        /* Make a list of the Preferences */
25        IF RowCount(@atts) > 0 THEN
26
27         SET @subAtts = Field(Row(@atts,1),"Attributes")
28         SET @pereference = Field(Row(@atts,1),"EmailTypePreference")
29         ]%%
30          <input type="checkbox" name="EmailTypePreference" value="true" %%[ if @pereference == "HTML" then ]%% checked="true" %%[endif]%%> HTML Emails <br/>
31          <small> When possible, send e-mail newsletters as HTML instead of plain text.</small>
32         %%[
33         Set @p = 1
34         /* for all the attributes make sure if the values are true or False */
35         FOR @c = 1 TO RowCount(@subAtts) DO
36          SET @att = Row(@subAtts,@c)
37          SET @att_name = Field(@att,'Name')
38          SET @att_val = Field(@att,'Value')
39
40
41          /* save the corresponding values to an array */
42          IF @att_val == "true" or @att_val == "false" then
43
44           SET @preferences = Concat(@att_name, "|" , @preferences)
45
46
47           ]%%
48            <input type="checkbox" name="%%=v(@att_name)=%%" value="true" %%[ IF @att_val == "true" then ]%% checked="true" %%[ ENDIF ]%%  /> %%=v(@att_name)=%% <br/>
49
50           %%[
51          ENDIF
52
53         NEXT @c
54        ENDIF
55
56        ]%%

How to Create the Administrative Page 

Use this code example as a model as you build your own administrative page.