Has anyone here ever worked with Huspot form tracking? I'm trying to set up some code to collect non Hubspot form information and enter it into Hubspot. I'm getting the error "coldfusion.runtime.ScopeCastException: You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members."
Maybe I have some CFM code that's not working in CF 10.? I that's the case, I'm familiar enough with different versions of CF. Could someone please take a look at my code to see if there'e anything that may be causing the error? I've looked at it a lot and tried differnt things but just not having any luck. I have the correct PORTALID and FORMGUID for the url, so those veriables are just place holders for this example.
<!--- Gather tracking cookie from headers and bundle into a json encoded dictionary --->
<cfset Cookies = getHttpRequestData().headers["Cookie"] />
<cfset trackingToken = Cookies["hubspotutk"] />
<cfset hscontext = {}>
<cfset hscontext["hutk"] = trackingToken>
<cfset jsonToken = serializeJSON(hscontext) />
<!--- Submit Data to hubspot, if no lead tracking is being done, only this part is needed --->
<!--- URL includes portal ID and form GUID --->
<cfhttp url="https://forms.hubspot.com/uploads/form/v2/PORTALID/FORMGUID"
method="POST" >
<cfhttpparam name="firstname" type="FormField" value="#form.firstname#">
<cfhttpparam name="lastname" type="FormField" value="#form.lastname#">
<cfhttpparam name="company" type="FormField" value="#form.company#">
<cfhttpparam name="email" type="FormField" value="#form.email#">
<cfhttpparam name="checkbox" type="FormField" value="#form.newsletter#">
<cfhttpparam name="hs_context" type="FormField" value="#jsonToken#">
</cfhttp>
Thanks!