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?

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!!

@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

Hi @SteveHTM !
Is possible take Contact ID these new contact with this script?

Prior to form submission, there may be no numeric Contact ID beacuse the record may not exist, and even if it did you cannot query the database from the client side like that.

But in many downstream cases you can use the email string as a substitute (idParameter = email in an API call for example).

Best of luck!

Ok @SteveHTM, thanks!