CMS Development

RMarinho5
Participant

Redirect URL based on form settings and contact ID

Hi!

I would like it if, after submitting an HS form, the redirect URL had some dinamics parameters based on informations of contact and their HubSpot ID. 

For example, after for submission, the lead is redirected to a URL like:

http://www.domínio.com/teste.php?name=NAME&id=HUBSPOT CONTACT ID

It's possible?

0 Upvotes
2 Replies 2
SteveHTM
Top Contributor | Partner
Top Contributor | Partner

Redirect URL based on form settings and contact ID

@RMarinho5 - although not supported as a true form editing function, this kind of adaptation is actually not too hard to achieve. You just need to be able to set up a custom module in the design tools that you use in place of a standard form embed for your laning pages.

 

In the module you set up the script for the form creation JS call and manipulate the parameters to that call - specifically in your case the redirectUrl parameter.

 

There is some rather ancient documentation for this kind of work here, which could do with an update: 

https://legacydocs.hubspot.com/docs/methods/forms/advanced_form_options

 

I don't want to assume you have an appetite for this kind of advanced plumbing - but just in case, here is a small segment of a forms call setup including a redirect with query parameters based on other form inputs:

hbspt.forms.create({
  region: "na1",
  portalId: "{{hub_id}}",
  formId: "{{ selected_form_id }}",
  onFormSubmitted: function($form, data) {
    // get submitted data and encode into redirect URL
    encoded_first = encodeURIComponent(data.submissionValues.firstname);
    encoded_last = encodeURIComponent(data.submissionValues.lastname);
    encoded_email = encodeURIComponent(data.submissionValues.email);
    let url = "{{app_url}}?first-name=" + encoded_first + "&last-name=" + encoded_last + "&email=" + encoded_email;
    // Redirect based on URL
    window.location.assign(url);
  }
});

 

Have fun!

 

Steve

Steve Christian

HTM Solutions

https://info.htmsolutions.biz/meetings/stevec2

mobilePhone
+1 6195183009
emailAddress
stevec@htmsolutions.biz
website
www.htmsolutions.biz
address
San Diego, CA
Create Your Own Free Signature
0 Upvotes
Endhrakumar
Contributor

Redirect URL based on form settings and contact ID

Hi there! 

 

There is no native way at the moment. Please share this on Idea submission.

1. If the parameters uses information from form submission. you can use it and make re-direct using JS. 
2. You can use workflows, share link via mail with parameters. 


Thank you! Happy Hubspoting!!

0 Upvotes