Calling SQL Server Stored Procedure


Our current website’s Contact Us page saves the contact information in a database by calling a stored procedure on a SQL Server available on the Internet via a connection string. We are replacing this Contact Us page with one utilizing Hubspot. How can the Hubspot page be coded to make the same stored procedure call when the form is submitted?

Thanks, John


@JohnR How are you making the call now? Is it server side or client side?



Thanks for the quick reply!

Currently, our web site is hosted and maintained by an offsite, third party company. I am not sure if they make the call from the website client code or server side, but I had had sent them example server side code which they somehow implemented in the current solution. A PDF version of what I had sent them is attached.

Thanks, John


@JohnR If you can make the call from the client I would look into leveraging the ajax JavaScript library to make the call. At the moment you won’t be able to make a server side request straight from the HubSpot COS. You will need to set up a proxy server to handle making the call if it has to be done server-side. I would see if you can find you what type of call it is and if the SQL server allows cross-origin requests or not if it is server-side.



Thanks for that. Assuming I can find a way to have javascript make the call, is there a way in Hubspot to make sure the call is not made unless the page validates (i.e. email in proper format, etc.)?

Thanks, John


@JohnR You can do anything from a front-end perspective on our platform. I would just protect the call in an if statement in your JavaScript .



After some research, I am not finding any way to make a client-side call to a SQL Server stored procedure. Even if there were ways, my concern would be that the connection string containing the logon credentials would be exposed to the client, which would not be good.

Are there any other Hubspot technologies we could leverage, even if it meant adding an interface at our end rather than a direct SQL Stored Proc call (e.g. webservice, etc.)?

Thanks, John


@JohnR It wouldn’t be HubSpot specific but could you just make an ajax call to a server on your end? The call could be just a generic trigger (including the contact info) so you wouldn’t be exposing any login credentials. Then once your web service on your server picks up the hook it could make the odbc connection to pass in the contact info and run the stored proc? You could do this on your sql server if you wanted or have a proxy server to handle this.