APIs & Integrations

jaron
Participant

How to generate a unique field in HubSpot Forms?

Is it possible to have HubSpot Auto Generate a unique number per form submission? Ideally, I would like to create a field which can be used across multiple forms which generates a unique number across all submissions. This will be used to track the form in HubSpot and Salesforce.

6 Replies 6
Dadams
HubSpot Employee
HubSpot Employee

How to generate a unique field in HubSpot Forms?

Hi @JaronEI

This isn’t something that we currently support. It’s possible to accomplish this with an external platform that could keep track of the unique number, using a combination of forms, workflows, and the Contacts API, but it’s not something that forms or workflows could do natively.

Can you tell me more about what you’d be doing with that unique id?

0 Upvotes
DaveJoRo
Participant

How to generate a unique field in HubSpot Forms?

This would be AWESOME for using unique codes for referral generation rather than having to export the contacts, add a unique code in excel and then re-import them.

I’m trying to create an ongoing referral generation campaign that can easily identify the referrer by the unique code they have that will be part of their own link to share our business. Right now I am going to have to do this in short term projects.

I’m also trying to find a way to automatically notify the hubspot owner of a referree when a referral has been generated by them. This isn’t possible from what I have been able to research so far.

0 Upvotes
jaron
Participant

How to generate a unique field in HubSpot Forms?

This is part of an opportunity registration process for partners. Would be used to track the opportunity through both HubSpot and Salesforce

0 Upvotes
salty_stephen
Contributor | Elite Partner
Contributor | Elite Partner

How to generate a unique field in HubSpot Forms?

Hi @JaronEI,

You could use JavaScript to generate a unique number for that form submission, either by generating a timestamp or some other unique identifier and have that populate into a hidden form field.

Thanks

LaurenWinter
Participant

How to generate a unique field in HubSpot Forms?

@salty_stephen can you explain a little more how to do this? I am using a form to track customers who want to return some stock for calibration at our warehouse. Each time a form is submitted I would like a unique reference number generated so that we can link it to their consignment note. 

0 Upvotes
salty_stephen
Contributor | Elite Partner
Contributor | Elite Partner

How to generate a unique field in HubSpot Forms?

@LaurenWinter 

 

You could do something like this:

 

// This will give you a HEX representation of the current time
let unique_id = new Date().getTime().toString(16)

You can then store that into a cookie that follows a person around the site or if you just need it once per submission, you can hook into the callback functions from the HS forms.

 

 

The only caveot I see here with an approch like this, is that it is relying on the system time of the user.

 

An alternative might be to "seed" the JavaScript date function with server time.

 

Some additonal documentation on setting a time stamp here: https://www.w3schools.com/jsref/jsref_settime.asp