Smart Capture form to show choices from a DE?

1k views Asked by At

I'm wondering if someone can possibly shed some light here, I have a smart capture form I'm building that has an add/update feature because of the primary key of "emailaddress"

I am pulling in the email address into a query string, which works great... the only thing though, is that I would like it to show a user's choice if they have already put in values into the DE previously.

For example here is the front end of the form, I would like it to show the choices a recipient already has before loading the page - similar to how it's pulling in their subscriber record. Is that possible? This page was built all with smart capture / cloud pages and a little ampscript to pull in their email address.

https://mcz5-l55x3kttqydms2vxt--5zkq.pub.sfmc-content.com/mrg20v12z2n?qs=ab0a1daabd536d524f3fc9c9356ad12470df153ed5fa9d014d7e7139de6192b957461dba656d17367648849aeb16d4db

1

There are 1 answers

1
Shobeasy On

Sounds like a preference center. You can look up values in the DE based on the email address you already have using the Lookup function. This assumes the email address variable is EmailAddress.

%%[
VAR @EventBooleanNullable2Value  
SET @EventBooleanNullable2Value = 
Lookup("[DE-NAME]","EventBoolean2Nullable","emailaddress", @EmailAddress)    
]%%

And then in your HTML for the form you set the value of the input element like this below, assuming the values for the "EventBooleanNullable2" in the DE are true or false.

<input type="checkbox" name="EventBooleanNullable2" data-field-type="Boolean" 
%%[IF @EventBooleanNullable2Value == "true" THEN]%%checked%%[ENDIF]%%>

https://ampscript.guide/lookup/