I need help with the pre-fill and update part of this:
- Create four Data extensions:"Subscribers" with subscriber attributes: SubscriberKey, FirstName, LastName, EmailAddress, PhoneNumber, BirthDate, Gender, Country, LastUpdated Date
- "Newsletter" with information about newsletter subscribers: SubscriberKey, Status (subscriberd/unsubscribed), LastUpdatedDate
- "SpecialOffers" with information about newsletter subscribers: SubscriberKey, Status (subscriberd/unsubscribed), LastUpdatedDate
- "Events" with information about newsletter subscribers: SubscriberKey, Status (subscriberd/unsubscribed), LastUpdatedDate
- Fill data in above data extensions with dummy data
- Create a simple email with a link at the bottom that says „Update your preferences" which takes the subscribers to the Custom Profile & Subscription Center you are going to build.
Create a Custom Profile & Subscription center on a CloudPage with the following fields: FirstName (text field),LastName (text field),EmailAddress (text field), PhoneNumber (text field), BirthDate (date field), Gender (drop-down list with options male/female/prefer not to say), Country (drop down or text field)Three checkboxes for subscription preferences:
- Newsletter,
- Special Offers,
- Events. Any changes to attributes should be updated in the Subscribers Data Extension. The checkboxes for each communication type should be reflected by a status field in a relevant Data Extension (subscribed/unsubscribed). For each form submission, LastUpdatedDate needs to be written into a Data Extension.Make sure the form is pre-populated with data when a subscriber visits the website.
The code I’ve tried:
%%[ VAR @SubscriberKey, @rows_subscribers, @row_subscribers, @firstName, @lastName, @email, @phone, @gender, @country, @iSET @SubscriberKey = RequestParameter("SubscriberKey")SET @SubscriberKey = toNumber(@SubscriberKey)SET @rows_subscribers = LookupRows("Subscribers", "SubscriberKey", @SubscriberKey) IF RowCount(@rows_subscribers) > 0 THEN FOR @i = 1 to RowCount(@rows_subscribers) DO SET @row_subscribers = Row(@rows_subscribers, @i) SET @firstName = Field(@row_subscribers, "FirstName") SET @lastName = Field(@row_subscribers, "LastName") SET @email = Field(@row_subscribers, "EmailAddress") SET @phone = Field(@row_subscribers, "PhoneNumber") SET @gender = Field(@row_subscribers, "Gender") SET @country = Field(@row_subscribers, "Country") NEXT @i ENDIF /* Newsletter */ VAR @rows_NewsLetter, @row_NewsLetter, @NewsletterStatus SET @rows_NewsLetter = LookupRows("Newsletter","SubscriberKey", @SubscriberKey) IF RowCount(@rows_NewsLetter) > 0 THEN FOR @i = 1 TO RowCount(@rows_NewsLetter) DO SET @row_NewsLetter = Row(@rows_NewsLetter, @i) SET @NewsletterStatus = Field(@row_NewsLetter, "Status") NEXT @i ENDIF /* Special Offers */ VAR @rows_Offer, @row_Offer, @offerStatus SET @rows_Offer = LookupRows("SpecialOffers","SubscriberKey", @SubscriberKey) IF RowCount(@rows_Offer) > 0 THEN FOR @i = 1 TO RowCount(@rows_Offer) DO SET @row_Offer = Row(@rows_Offer, @i) SET @offerStatus = Field(@row_Offer, "Status") NEXT @i ENDIF /* Events */ VAR @rows_Event, @row_Event, @eventStatus SET @rows_Event = LookupRows("Events","SubscriberKey", @SubscriberKey) IF RowCount(@rows_Event) > 0 THEN FOR @i = 1 TO RowCount(@rows_Event) DO SET @row_Event = Row(@rows_Event, @i) SET @eventStatus = Field(@row_Event, "Status") NEXT @i ENDIF /*experimental*//* set @subscriberKey = RequestParameter("subscriberKey")set @firstName = RequestParameter("FirstName")set @lastName = RequestParameter("LastName")set @emailAddress = RequestParameter("EmailAddress")set @phone = RequestParameter("PhoneNumber")set @gender = RequestParameter("Gender")set @country = RequestParameter("Country")UpdateData( "SubscriberKey", @subscriberKey, "FirstName", @firstName, "LastName", @lastName, "EmailAddress", @emailAddress,"PhoneNumber", @phone,"Gender", @gender,"Country", @country)UpdateData("Newsletter", 1 ,"SubscriberKey", @subscriberKey,"Status",@NewsletterStatus)UpdateData("SpecialOffers", 1,"SubscriberKey", @subscriberKey,"Status",@offerStatus)UpdateData("Events", 1,"SubscriberKey", @subscriberKey,"Status",@eventStatus) */]%% Also in email studio: %%[VAR @subscriberKey, @cloudPageURLSET @subscriberKey = AttributeValue("SubscriberKey")SET @cloudPageURL = CloudPagesURL('3382','SubscriberKey',@subscriberKey)]%%
Update your preferences!