0

I have created a basic Smart Capture (name, first name, email address...) form in Cloud Pages. I also have the Subscriber Key as a hidden field. I would like it to be automatically populated with the same value as the one entered in Email Address.

I added the AMP Script %%Email Address%% to value in the code as below but it doesn't bring back any value.

<input name="Subscriber Key" type="hidden" value="%%Email Address%%"></form>

Is that the correct way to do? Or am I doing it wrong and how can I have the subscriber key automatically populated with the email?

Many thanks for your help.

A.P.

<table cellpadding="0" cellspacing="0" width="100%" class="stylingblock-content-wrapper" style="min-width: 100%; "><tr><td class="stylingblock-content-wrapper camarker-inner">
<form id="smartcapture-block-u7fm754onlb" class="smartcapture-content-wrapper fuelux" novalidate="novalidate">

<style id="smartcapture-styles-u7fm754onlb">
 #smartcapture-block-u7fm754onlb {
  background-color:#FFFFFF;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;text-align:left;margin:0px 0px 50px 50px;padding:10px;
 }

 #smartcapture-block-u7fm754onlb .smartcapture-controls {
  padding-bottom: 10px;
 }

 #smartcapture-block-u7fm754onlb .smartcapture-controls .sc-formfield-label,
 #smartcapture-block-u7fm754onlb .smartcapture-controls .sc-formfield-label label,
 #smartcapture-block-u7fm754onlb .smartcapture-controls .sc-formfield-input label {
  color:#000000;font-family:Arial, Helvetica, sans-serif;font-size:13px;
 }

 #smartcapture-block-u7fm754onlb input[type="radio"],
 #smartcapture-block-u7fm754onlb input[type="checkbox"] {
  margin: 0 0.4em 3px 0;
  vertical-align: middle;
 }

 #smartcapture-block-u7fm754onlb input[type="text"],
 #smartcapture-block-u7fm754onlb input[type="email"],
 #smartcapture-block-u7fm754onlb input[type="number"] {
  width:200px;
 }

 #smartcapture-block-u7fm754onlb .sc-button {
  background-color:#000000;border-color:#000000;border-radius:3px;border-style:solid;-webkit-border-radius:3px;-moz-border-radius:3px;color:#FFFFFF;font-family:Arial, Helvetica, sans-serif;font-size:14px;line-height:normal;padding:10px;
 }

 #smartcapture-block-u7fm754onlb .smartcapture-submit-button-wrapper {
  padding-bottom:10px;text-align:left;
 }

 #smartcapture-block-u7fm754onlb .date-dropdown-select-boxes input {
  display: none;
 }

 #smartcapture-block-u7fm754onlb .date-dropdown-select-boxes .select {
  max-height: 28em;
  max-width: 6em;
  overflow: auto;
 }
</style>

 <div data-type="slot" data-key="98lxuqif8ts"></div>
 <div class="smartcapture-submit-button-wrapper">
  <button type="submit" class="sc-button">SUBMIT</button>
 </div>










<script id="smartcapture-script-u7fm754onlb">
 var scFormLoaded = function () {
  window.ScForm.init({"gearID":"u7fm754onlb","smartCaptureFormID":298,"sourceKey":"48C16CC9-5B6A-4C84-B669-8E1959DB2ED5","source":"dataExtension","triggeredSend":"","confirmationMessage":"<div style=\"text-align: center;\">\n\t<br />\n\t<br />\n\t<span style=\"color:#000000;\"><span style=\"font-size:20px;\"><b><span style=\"font-family:arial,helvetica,sans-serif;\">THANK YOU FOR YOUR NOMINATION!</span></b></span></span><br />\n\t<br />\n\t&nbsp;</div>","buttonText":"SUBMIT","formStyling":{"background-color":"#FFFFFF","margin-top":"0px","margin-right":"0px","margin-bottom":"0px","margin-left":"0px","padding-top":"0px","padding-right":"0px","padding-bottom":"0px","padding-left":"0px","text-align":"left","margin":"0px 0px 50px 50px","padding":"10px"},"fieldStyling":{"width":"200px"},"buttonStyling":{"background-color":"#000000","border-color":"#000000","border-radius":"3px","border-style":"solid","-webkit-border-radius":"3px","-moz-border-radius":"3px","color":"#FFFFFF","font-family":"Arial, Helvetica, sans-serif","font-size":"14px","line-height":"normal","padding":"10px"},"onSubmitGotoUrlType":2,"onSubmitGotoUrl":"https://www.pinkshirtmaker.com"});
 };
 window.appDomain = window.appDomain || '<ctrl:eval>Platform.Variable.GetValue("@appDomain")||""</ctrl:eval>';
 window.contentDetail = window.contentDetail || <ctrl:eval>Platform.Variable.GetValue('@contentDetail')||{}</ctrl:eval>;
 if (!window.ScForm || !window.ScForm.init) {
  var head = document.getElementsByTagName('head')[0];
  var id = 'smartcapture-formjs-script';
  var script = document.getElementById(id);
  var domain = window.appDomain;
  var el;
  if (!script) {
   if (domain) {
    domain = '//' + domain;
   }
   el = document.createElement('script');
   el.async = true;
   el.id = id;
   el.src = domain + '/CloudPages/lib/smartcapture-formjs.js';
   el.onload = scFormLoaded;
   head.appendChild(el);
  } else {
   if (script.addEventListener) {
    script.addEventListener('load', scFormLoaded);
   } else if (script.attachEvent) {
    script.attachEvent('onload', scFormLoaded);
   }
  }
 } else {
  scFormLoaded();
 }
</script>


  <input name="Phone Number" type="hidden" value=""><input name="Subscriber Key" type="hidden" value="%%Email Address 2%%"></form>
</td></tr></table>
  • Hi @Aurelien, Welcome to SFSE! Can you please paste the whole code. In that way it will much easier to solve. Thanks! – Naveen VM May 11 at 10:20
  • Hi Naveen, please see above - actually we capture two email addresses - and it's the Email Address 2 that we would like to be the Subscriber Key. I've updated that but still doesn't work. Thanks! – Aurelien May 11 at 11:05
  • Hi @Aurelien, Thanks for updating the question. Smart capture have very limited scope of functionality in terms of modifying with ampscript. From my experience, You can set a static value in the hidden attribute or if you have a parameter in URL then it can able capture. But getting the value of email address dynamically is something not possible with standard smart capture. I would suggest you to build a form with all fields then you can able to capture the hidden fields and add into data extension using Upsert or insert ampscript. – Naveen VM May 12 at 4:19
0

as per the documentation here: https://help.salesforce.com/articleView?id=mc_es_available_personalization_strings.htm&type=5 the correct syntax for the email is %%emailaddr%%. This should solve your immediate issue.

Whether the email address makes for a good subscriberkey (it usually isn't) is another story of course.

| improve this answer | |
  • Hi Jonas, thanks for the link. Yes I would usually use a Contact ID/Lead ID or an external ID as the key - but this is an internal form and I don't want to create the internal contacts we capture in Sales Cloud, just in the data extension . However I think I still need a Subscriber Key to send them an email via journey builder - hence the use of the Email Address. – Aurelien May 11 at 11:11
  • Understood, and probably something that you have to do that way due to the limits of Smart Capture. The reason why I'd question this approach is that your SubscriberKey is then personally identifiable data, which goes into all sorts of reports (data views etc), which is not a good practice. – Jonas Lamberty May 11 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.