Losing variable. Element is undefined in VARIABLES

此生再无相见时 提交于 2019-12-12 04:15:19

问题


We are getting this error in both ColdFusion 9 and ColdFusion 11 servers in production. I originally thought is related to ColdFusion 9 and JavaHeap space or not enough memory. We moved this process to run on a brand new server (ColdFusion 11) where nothing else is running and has a lot of memory and we still get the error. Here is some of the code for this cfm page:

<cfset variables.email_count = 0>
<!--- email notifications --->
<cfoutput query="getOrdersForNotification" group="order_id">

    <cfset variables.inv = "">
    <cfset variables.usePdf = false>
    <cfif isDefined("application.feature_list_using_pdf_attachment")
            and listFindNoCase(application.feature_list_using_pdf_attachment, "injection scheduler", ",")
        >
        <cfset variables.usePdf = true>
    </cfif>

    <cfthread name="InjectionSchdEmail#dateFormat(now(), 'mmdd')#_#timeFormat(now(), 'HHmmss')#_#getOrdersForNotification.order_id#"
        threadOrderId="#getOrdersForNotification.order_id#"
        threadMemberId="#getOrdersForNotification.member_id#"
        threadNotificationEmail="#getOrdersForNotification.notification_email#"
        threadDateReq="#getOrdersForNotification.date_req#"
        threadStoreCode="#getOrdersForNotification.store_code#"
        threadStoreName="#getOrdersForNotification.store_name#"
        threadToGoLabel="#application.togo_label#"
        threadOrderTotal="#getOrdersForNotification.order_total#"
        threadDelTimeValueFront="#getOrdersForNotification.del_time_value_front#"       
        threadSubject="#variables.subjectAndBodyTemplates.subject#"
        threadBody="#variables.subjectAndBodyTemplates.body#"
        threadFromEmail="#variables.fromEmail#"
        threadLocalNow="#variables.localNow#"
        threadLocalNowInt="#variables.localNowInt#"
        threadDs="#ds#"
        threadUsePdf="#variables.usePdf#"
        >
        <cftry>
            <cfset url.order_id = threadOrderId>
            <cfset url.member_id = threadMemberId>
            <cfsavecontent variable="variables.inv">
                <cfinclude template="invoicedeska.cfm">
            </cfsavecontent>

            <cfset variables.order_day=dateFormat(application.UdfService.toSlashDate(threadDateReq), 'mmm dd')>

            <cfset local.subject = threadSubject>
            <cfset local.subject = ReplaceNoCase(local.subject, "[Store Code]", threadStoreCode, "all")>
            <cfset local.subject = ReplaceNoCase(local.subject, "[Takeout Label]", threadToGoLabel, "all")>
            <cfset local.subject = ReplaceNoCase(local.subject, "[Order ID]", threadOrderId, "all")>
            <cfset local.subject = ReplaceNoCase(local.subject, "[Order Total]", NumberFormat(threadOrderTotal,"9,999.99"), "all")>
            <cfset local.subject = ReplaceNoCase(local.subject, "[Required Time]", threadDelTimeValueFront, "all")>
            <cfset local.subject = ReplaceNoCase(local.subject, "[Required Date]", variables.order_day, "all")>

            <cfset local.body = threadBody>
            <cfset local.body = ReplaceNoCase(local.body, "[Store Code]", threadStoreCode, "all")>
            <cfset local.body = ReplaceNoCase(local.body, "[Store Name]", threadStoreName, "all")>
            <cfset local.body = ReplaceNoCase(local.body, "[Order ID]", threadOrderId, "all")>
            <cfset local.body = ReplaceNoCase(local.body, "[Order Total]", NumberFormat(threadOrderTotal,"9,999.99"), "all")>
            <cfset local.body = ReplaceNoCase(local.body, "[Required Time]", threadDelTimeValueFront, "all")>
            <cfset local.body = ReplaceNoCase(local.body, "[Required Date]", variables.order_day, "all")>
            <cfset local.body = "<span style='font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: ##000000'>#application.UdfService.multiLiner(local.body)#</span>">

            <cfif threadUsePdf>
                <!--- PDF version --->
                <cfdocument 
                    format="PDF" 
                    name="variables.attachment" 
                    localURL="#application.pdf_localURL#" 
                    orientation="#application.pdf_orientation#"
                    marginleft="#application.pdf_marginleft#" 
                    marginright="#application.pdf_marginright#" 
                    margintop="#application.pdf_margintop#" 
                    marginbottom="#application.pdf_marginbottom#" 
                    unit="#application.pdf_unit#" 
                    scale="#application.pdf_scale#"
                >
                    #variables.inv#
                </cfdocument>
            <cfelse>
                <!--- HTML version --->
                <cfset variables.attachment = variables.inv>
            </cfif>

            <cfmail to="#threadNotificationEmail#" from="#threadFromEmail#" subject="#local.subject#" type="html">
                #local.body#
                <cfif isDefined("variables.attachment") and threadUsePdf eq false>
                    <cfmailparam
                        file="invoice_#threadOrderId#_#threadLocalNowInt#.html"
                        type="application/html"
                        content="#variables.attachment#"
                        />
                <cfelseif isDefined("variables.attachment") and threadUsePdf>
                    <cfmailparam
                        file="invoice_#threadOrderId#_#threadLocalNowInt#.pdf"
                        type="application/pdf"
                        content="#variables.attachment#"
                        />
                </cfif>
            </cfmail>

            <cfset invoice_emailed = application.MessageService.setEmailedInvoice(orderId = threadOrderId, localNow = threadLocalNow, emailAddress = threadNotificationEmail, datasource = threadDs)>

            <cfcatch type="any">
                <cfset variables.attachment = "">
                <cfmail from="erroralerts@monkeymediasoftware.com" to="erroralerts@monkeymediasoftware.com" type="html" subject="POS injection notification email faliure">
                    <cfif isDefined("cgi.server_name")>
                        Server: <b>#cgi.server_name#</b>
                    </cfif>
                    <cfdump var="#cfcatch#" label="cfcatch"><br />
                    <cfdump var="#threadOrderId#" label="threadOrderId"><br />
                    <cfdump var="#threadMemberId#" label="threadMemberId"><br />
                    <cfdump var="#threadNotificationEmail#" label="threadNotificationEmail"><br />
                    <cfdump var="#threadDateReq#" label="threadDateReq"><br />
                    <cfdump var="#threadStoreCode#" label="threadStoreCode"><br />
                    <cfdump var="#threadStoreName#" label="threadStoreName"><br />
                    <cfdump var="#threadToGoLabel#" label="threadToGoLabel"><br />
                    <cfdump var="#threadOrderTotal#" label="threadOrderTotal"><br />
                    <cfdump var="#threadDelTimeValueFront#" label="threadDelTimeValueFront"><br />
                    <cfdump var="#local.subject#" label="local.subject"><br />
                    <cfdump var="#local.body#" label="local.body"><br />
                    <cfdump var="#threadFromEmail#" label="threadFromEmail"><br />
                    <cfdump var="#threadLocalNow#" label="threadLocalNow"><br />
                    <cfdump var="#threadLocalNowInt#" label="threadLocalNowInt"><br />
                    <cfdump var="#threadDs#" label="threadDs"><br />
                    <cfdump var="#threadUsePdf#" label="threadUsePdf"><br />
                    <cfdump var="#variables.inv#" label="variables.inv"><br />
                </cfmail>
                <cfrethrow />
            </cfcatch>
        </cftry>
    </cfthread>

    <cfset variables.email_count = variables.email_count + 1>
</cfoutput>

<p></p><cfoutput>#variables.email_count# emails sent @ #local_now()#</cfoutput>

Error:

Element EMAIL_COUNT is undefined in VARIABLES.
The error occurred on line

来源:https://stackoverflow.com/questions/34164252/losing-variable-element-is-undefined-in-variables

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!