Loading

Redirect to Thank You Pages Based on Account Engagement Form Field Values

Fecha de publicación: Sep 30, 2025
Descripción

You can redirect a prospect to a different page based on the value they submit for a field in the form.

NOTE: The examples in the article use Account Engagement's PML variable tags. If your account has upgraded to HML, you'll want to replace the PML tags below with the corresponding HML tags found here.
This process requires custom Javascript and assumes a working knowledge of coding. This process is not officially supported and Account Engagement Support will be unable to help troubleshoot the contents of this article. 

Solución
By placing the following code in the "thank you code" for the form (found in tab 4 "Completion Actions" in the Account Engagement form editor), we can redirect based on a field value:

<script type="text/javascript">
  switch('%%Free_Trial{js}%%') {
  case 'Free Trial':
  document.location='http://www.yoursite.com/thank-you-free-trial/';
  break;
  case 'Live Demo':
  document.location='http://www.yoursite.com/thank-you-live-demo/';
  break;
  }
</script>


This example will redirect to one location if the value is Free Trial, and another if the value is Live Demo

Notes:
○ %%Free_Trial{js}%% is the form field variable tag (JavaScript encoded).
Free Trial is the first value in the field we're looking for, Live Demo is the second.
document.location is the redirect location.

Considerations:
○ We recommend JavaScript-encoding your variable tags using {js}. This will prevent special characters from breaking your variable tag's output, and prevent arbitrary code from executing.
○ If you are using an Account Engagement form through an iframe and want to redirect the whole page, change document.location to parent.location.
○ You can add more values if needed. Just add another snippet:
case 'Subscription':
document.location='http://www.yoursite.com/thank-you-subscription/';
break;

○ In order for the script to work correctly, you must have "allow for multiple responses" unchecked in the field set-up.
Número del artículo de conocimiento

000383490

 
Cargando
Salesforce Help | Article