Set sfdcCampaignId via onFormSubmit?

hubdb
forms

#1

I’m trying to setup a dynamic page via hubdb that will require a form linked to a different SFDC campaign on each branch of the page. I think it should be simple enough to pass in the SFDC ID as set in the hubdb table via the onFormSubmit callback, but I am not clear on the syntax…

Can you run $.ajax inside the callback and post it via the API? or is there a simpler way?

Thank you!


#2

Hi @Asa_Curry,

That might work, but the request probably won’t complete before the visitor is redirected after the form submission. While I’m not entirely sure what your setup is, you could use the HubDB HubL methods instead of the JSON HTTP methods:


#3

Hi Derek,

Could you elaborate on the HubDB methods you are referring to, or direct me to where you are looking in the documentation? I don’t see how to manipulate a form submit event or a lead record based using Hubl/HubDB in on the main HubDB link you provided.

Thank you!


#4

Hi @Asa_Curry,

The article I linked above includes some frontend methods for pulling values from HubDB. They’re very similar in structure to the HTTP HubDB methods, the documentation for which I’ve included below. You could pull the relevant campaign ID from HubDB using these methods, and put it into the hidden form field using either the form’s onFormReady (if you can do it right when the form loads) or the 'onFormSubmit` (if you need to wait for submission) methods.