APIs & Integrations

AliFawadHassan
Participant

Custom Code Action for Form Submission

SOLVE

Dear HubSpot Community,

I am currently working on a form that includes custom fields such as property name, address, along with standard fields like email and name. Upon form submission, I aim to use custom code to achieve the following:

  1. Read the form submission data.
  2. Use the custom properties to create a custom object in HubSpot.
  3. Associate this custom object with the contact, using a specific label.


However, after reviewing the available options, it appears that there is no straightforward way to add a custom code action for form submissions.


Could anyone guide me on how to implement this functionality? Your assistance would be greatly appreciated.

Thank you in advance for your help!

Best regards,
Ali

0 Upvotes
1 Accepted solution
SteveHTM
Solution
Key Advisor

Custom Code Action for Form Submission

SOLVE

One last try on this - again I feel there are some drossed wires.

 

When the form you have constructed is submitted, the data collected by the form fields are already in the record created by the form submission. This is true for contact objects or custom objects.

So if you have defined custom contact properties as described in your original question - such as 'property name' - and included them as fields on the form being filled then those propoerty values are directly accessible in the contact workflow triggered by the submit action. You can pass them as input parameters to your custom code workflow step. 

 

There is no need to reference any action properties - that seems like a red herring to be honest.

 

Additionally, if you have defined a custom object - example MyObject with properties CustomA, CustomB, CustomC - then you can include those properties, if required, on the same form. This would additionally enable you to construct a MyObject type workflow with a trigger such as CustomA is known. When that type of workflow executes, the property values from the form fill are directly accessible - again you can pass them as input parameters to your custom code workflow step.

 

I hope this is useful to you.

 

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

View solution in original post

8 Replies 8
MLBurg
Participant

Custom Code Action for Form Submission

SOLVE

I agree with the poster. I am having the same issue. I am trying to use custom code to register attendees to a marketing avent that have already had a form submission go through as we didn't have the workflow created prior to this form going live so I am trying to get the form submission date to be the same as the registration date but I cannot seem to find a way to pull the form submission date?

0 Upvotes
SteveHTM
Key Advisor

Custom Code Action for Form Submission

SOLVE

@AliFawadHassan - I'm sure there must be something missing in the problem description here. The mechanisms I use regularly in (apparently) the same situation is to define the form around the custom object properties, trigger a workflow on submission (or value 'known') and then use custom code workflow steps to manioulate the properties and associate records together. This all works very effectively.

 

What are we missing?

 

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
AliFawadHassan
Participant

Custom Code Action for Form Submission

SOLVE

Hi @SteveHTM  
How can i read the form submission data, that i can use in my custom code ?

AliFawadHassan_0-1718811295341.png

 

SteveHTM
Key Advisor

Custom Code Action for Form Submission

SOLVE

This is where I think there must be a miscommunication - if some of the properties of the custom object are set using form fields, then after form submission you should be able to refrence those directly. For example you could use them as input variables for the custom code.

 

Checking that we are getting closer...

 

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
AliFawadHassan
Participant

Custom Code Action for Form Submission

SOLVE

@SteveHTM  There is no unique field that I can refer to in the custom object, and as you can see, I'm unable to get any form data. If I get the submission ID, I will easily get the data through the API, but I'm unable to get any data from the form submission trigger.
Capture.PNG

 

dsmarion
Top Contributor | Gold Partner
Top Contributor | Gold Partner

Custom Code Action for Form Submission

SOLVE

Someone will correct me if I am wrong but I don't think it is possible to trigger a workflow on a form submission.

Scott Marion
Senior Developer @ Thread Connected Marketing
0 Upvotes
AliFawadHassan
Participant

Custom Code Action for Form Submission

SOLVE

We can trigger a workflow; that's possible. However, the issue I'm facing is that I want to read the form submission data and use custom code to perform manual tasks, such as associations.

0 Upvotes
SteveHTM
Solution
Key Advisor

Custom Code Action for Form Submission

SOLVE

One last try on this - again I feel there are some drossed wires.

 

When the form you have constructed is submitted, the data collected by the form fields are already in the record created by the form submission. This is true for contact objects or custom objects.

So if you have defined custom contact properties as described in your original question - such as 'property name' - and included them as fields on the form being filled then those propoerty values are directly accessible in the contact workflow triggered by the submit action. You can pass them as input parameters to your custom code workflow step. 

 

There is no need to reference any action properties - that seems like a red herring to be honest.

 

Additionally, if you have defined a custom object - example MyObject with properties CustomA, CustomB, CustomC - then you can include those properties, if required, on the same form. This would additionally enable you to construct a MyObject type workflow with a trigger such as CustomA is known. When that type of workflow executes, the property values from the form fill are directly accessible - again you can pass them as input parameters to your custom code workflow step.

 

I hope this is useful to you.

 

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