Created
November 19, 2012 18:35
-
-
Save nifl/4112628 to your computer and use it in GitHub Desktop.
Queries QB for record object. If record ID exists, update; Otherwise create new record.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- | |
Name: record.cfm | |
Author: Gernot Bartels | |
Description: Queries QB for record object. | |
If record ID exists, update; | |
Otherwise create new record. | |
History: Created | |
Added logic | |
Usage: Surveys, Intake, | |
Created: 2011-08-05 | |
Updated: 2012-02-15 | |
---> | |
<!--- return record object ---> | |
<cfinvoke component="components.qbQuery" method="qFieldVal" returnvariable="recordObject"> | |
<cfinvokeargument name="qbURL" value="#qbURL#" /> | |
<cfinvokeargument name="theTable" value="#tableID#" /> | |
<cfinvokeargument name="theTicket" value="#ticket#" /> | |
<cfinvokeargument name="theToken" value="#token#" /> | |
<cfinvokeargument name="theField" value="#uField#" /> | |
<cfinvokeargument name="theValue" value="#uValue#" /> | |
<cfinvokeargument name="theList" value="#uList#" /> | |
</cfinvoke> | |
<!--- check returned object for record ID ---> | |
<cfif isDefined("recordObject.qdbapi.record.XmlAttributes.rid")><!--- update record ---> | |
<cfset recordID = #recordObject.qdbapi.record.XmlAttributes.rid# > | |
<cfinvoke component="components.qbAPI" method="updateRecord" returnvariable="Record"> | |
<cfinvokeargument name="qbURL" value="#qbURL#" /> | |
<cfinvokeargument name="tableID" value="#tableID#" /> | |
<cfinvokeargument name="recordID" value="#recordID#" /> | |
<cfinvokeargument name="content" value="#qb_xml#" /> | |
<cfinvokeargument name="theTicket" value="#ticket#" /> | |
<cfinvokeargument name="theToken" value="#token#" /> | |
</cfinvoke> | |
<cfoutput> | |
from record update:</br> | |
#Record#</br> | |
</cfoutput> | |
<cfelse><!--- create record ---> | |
<cfinvoke component="components.qbAPI" method="createRecord" returnvariable="Record"> | |
<cfinvokeargument name="qbURL" value="#qbURL#" /> | |
<cfinvokeargument name="tableID" value="#tableID#" /> | |
<cfinvokeargument name="newRecord" value="#qb_xml#" /> | |
<cfinvokeargument name="theTicket" value="#ticket#" /> | |
<cfinvokeargument name="theToken" value="#token#" /> | |
</cfinvoke> | |
<cfoutput> | |
from record create:</br> | |
#Record#</br> | |
</cfoutput> | |
</cfif> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment