ColdFusion Fax – Get Detailed Information About Submitted Faxes

The FaxQuery method allows you to retrieve information about one or more submitted faxes with ColdFusion. This method has more flexible querying options than FaxStatus (for more details, see Side-by-side Comparison of Web Service Methods).

The ColdFusion fax snippet below demonstrates how to display detailed information for a number of transmitted faxes:


<cfoutput>

<!--- Username and password for the Interfax account. --->
<cfset interfaxUsername = "">
<cfset interfaxPassword = "">

<!--- Init the inout arguments --->
<cfset ResultCode = 0>


<!--- Create and call the web service --->
<cfset faxWebService = CreateObject("webservice", "https://ws.interfax.net/dfs.asmx?WSDL")>

<cfset faxItem = faxWebService.FaxQuery(interfaxUsername, interfaxPassword, "gt", 1, 2, "ResultCode")>


<!--- If call was succesfull then display fax info--->
<cfif ResultCode eq 0>

        <cfloop from="0" to="#ArrayLen( faxItem.faxItemEx ) - 1#" index="faxIndex">
            <cfset currentFaxItem = faxItem.getFaxItemEx( JavaCast("int", faxIndex) )>

            <table border="2">
                <tr><th>ParentTransactionID</th><td>#currentFaxItem.getParentTransactionID()#</td></tr>
                <tr><th>TransactionID</th><td>#currentFaxItem.getTransactionID()#</td></tr>
                <tr><th>SubmitTime</th><td>#currentFaxItem.getSubmitTime()#</td></tr>
                <tr><th>PostponeTime</th><td>#currentFaxItem.getPostponeTime()#</td></tr>
                <tr><th>CompletionTime</th><td>#currentFaxItem.getCompletionTime()#</td></tr>
                <tr><th>UserID</th><td>#currentFaxItem.getUserID()#</td></tr>
                <tr><th>DestinationFax</th><td>#currentFaxItem.getDestinationFax()#</td></tr>
                <tr><th>ReplyEmail</th><td>#currentFaxItem.getReplyEmail()#</td></tr>
                <tr><th>RemoteCSID</th><td>#currentFaxItem.getRemoteCSID()#</td></tr>
                <tr><th>PagesSent</th><td>#currentFaxItem.getPagesSent()#</td></tr>
                <tr><th>Status</th><td>#currentFaxItem.getStatus()#</td></tr>
                <tr><th>Duration</th><td>#currentFaxItem.getDuration()#</td></tr>
                <tr><th>Subject</th><td>#currentFaxItem.getSubject()#</td></tr>
                <tr><th>PagesSubmitted</th><td>#currentFaxItem.getPagesSubmitted()#</td></tr>
                <tr><th>SenderCSID</th><td>#currentFaxItem.getSenderCSID()#</td></tr>
                <tr><th>Priority</th><td>#currentFaxItem.getPriority()#</td></tr>
                <tr><th>Units</th><td>#currentFaxItem.getUnits()#</td></tr>
                <tr><th>CostPerUnit</th><td>#currentFaxItem.getCostPerUnit()#</td></tr>
                <tr><th>PageSize</th><td>#currentFaxItem.getPageSize()#</td></tr>
                <tr><th>PageOrientation</th><td>#currentFaxItem.getPageOrientation()#</td></tr>
                <tr><th>PageResolution</th><td>#currentFaxItem.getPageResolution()#</td></tr>
                <tr><th>RenderingQuality</th><td>#currentFaxItem.getRenderingQuality()#</td></tr>
                <tr><th>RetriesToPerform</th><td>#currentFaxItem.getRetriesToPerform()#</td></tr>
                <tr><th>TrialsPerformed</th><td>#currentFaxItem.getTrialsPerformed()#</td></tr>
            </table>
            <br />
        </cfloop>

<cfelse>

    Error receiving fax status: #resultCode#

</cfif>
</cfoutput>