Help someone! Apologies in advance wasn't sure whe...
# lucee
m
Help someone! Apologies in advance wasn't sure whether to post this here or on the cfml channel but the code is being written on a Lucee server so thought it may be appropriate here. I have no errors in the console of CF debug and the CFC is definitely being referenced but nothing gets inserted into the database. I have the exact same insert statement working fine on a cfm page but the CFC version just refuses to insert the record. Can anyone advise what the issue is here ?
<cfcomponent displayname="Beneficiaries" hint="ColdFusion Component for Add Beneficiaries">
<cffunction name="ProcessForm" access="remote" output="true" returntype="string" returnformat="plain"> <!--- Get the HTTP request body content. NOTE: We have to use toString() as an intermediary method call since the JSON packet comes across as a byte array (binary data) which needs to be turned back into a string before ColdFusion can parse it as a JSON value. ---> <cfset requestBody = toString( getHttpRequestData().content ) /> <!--- Double-check to make sure it's a JSON value. ---> <cfif isJSON( requestBody )> <!--- Echo back POST data. ---> <cfdump var="#deserializeJSON( requestBody )#" label="HTTP Body" /> <cfset myArrayObj = obj.fn> <Cfdump var="#myArrayObj[1]#"> <cfquery name="myQuery" datasource="boi-interview-local"> INSERT INTO dbo.boi_beneficiaries (firstname) VALUES(<cfqueryparam value="#myArrayObj[1]#" cfsqltype="CF_SQL_VARCHAR">) </cfquery> </cfif> </cffunction> </cfcomponent> Many thanks