How can I pull the ID # from a URL into a hidden field on a HS form
SOLVE
Hello!
I am quite new to HubSpot and I need help with capturing an ID # within the URL of a HS form. Specifically, how can I pull the ID # from a URL into a hidden field on a form?
I read that I need to implement a custom script that extracts the ID # from the URL and populates the hidden field with this value.
But I do not know how to write a custom script to capture this ID from the URL. I would imagine, I would need to write some JS to do this.
How can I pull the ID # from a URL into a hidden field on a HS form
SOLVE
@PMc8 - luckily this is quite a simple thing to capture.
If you can make the query parameter name (as in URL?parametername=myvalue) match the internal name of the form field property, then the hidden field value on the form will be poulated.
If you can't make the parameter name match the internal property name, then it's also possible to do a bit of parsing on the 'last page seen' URL value to extract an arbitrary query property value (this may require some cusom code work depending on complexity) using a workflow and store the captured value in your chosen property.
How can I pull the ID # from a URL into a hidden field on a HS form
SOLVE
@SteveHTM You mentioned the exact issue I am facing- the URL parameter has an uppercase "I" so the internal Hubspot value is not matching. Do you have any example codes I could reference for capturing the 15-digit value after "referrerId"? Or is it something like Excel where you parse "=right("field", 15)?
How can I pull the ID # from a URL into a hidden field on a HS form
SOLVE
@GAlvarez07 - fr my issues with this, I used a Custom code workflow step to be able to invoke a couple of line of Python code that translate the URL string to one that can be stored in the HubSpot property. As mentioned I used that code on the 'last page seen' Contact property after the submit action - so the action is not as immediate or as integrated as if the query string contained the correct internal property name as documented.
How can I pull the ID # from a URL into a hidden field on a HS form
SOLVE
@SteveHTMThank you for your quick response! So if I follow you correctly, then I need to make a hidden field property with the same name as the URL parameter name value that I want to capture.
How can I pull the ID # from a URL into a hidden field on a HS form
SOLVE
@PMc8 - luckily this is quite a simple thing to capture.
If you can make the query parameter name (as in URL?parametername=myvalue) match the internal name of the form field property, then the hidden field value on the form will be poulated.
If you can't make the parameter name match the internal property name, then it's also possible to do a bit of parsing on the 'last page seen' URL value to extract an arbitrary query property value (this may require some cusom code work depending on complexity) using a workflow and store the captured value in your chosen property.