ColdFusion Fax – Get Submitted Fax Information with FaxStatus

This sample demonstrates how to retrieve information about one or more submitted faxes from ColdFusion.

The ColdFusion fax snippet below displays information for a number of submitted faxes using the the FaxStatus method.


<cfoutput>

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

<!--- Enter the transaction ID for which data is to be retrieved, or "999999999" for the most recent transaction(s) --->
<cfset LastTransactionID = 999999999>

<!--- LastTransaction ID needs to be one higher  than the transaction be queried for --->
<cfif LastTransactionID neq 999999999>
    <cfset LastTransactionID = LastTransactionID + 1>
</cfif>

<!--- Number of transactions to return information for --->
<cfset MaxItems = 10>

<!--- Init the Output arguments --->
<cfset totalFaxCount = 0>
<cfset faxListSize   = 0>
<cfset ResultCode    = 0>


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

<cfset faxItems = faxWebService.FaxStatus(interfaxUsername, interfaxPassword, LastTransactionID, MaxItems, "totalFaxCount", "faxListSize", "ResultCode")>


<!--- If call was succesfull then display info for the faxes --->
<cfif ResultCode eq 0>

    <strong>Total number of faxes: #totalFaxCount#.</strong><br /><br />

    <cfset faxListSize = faxListSize - 1>
    <cfloop from="0" to="#faxListSize#" index="faxIndex">
        <cfset currentFaxItem = faxItems.getFaxItem( JavaCast("int", faxIndex) )>

        <table border="2">
            <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>DestinationFax</th><td>#currentFaxItem.getDestinationFax()#</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 nowrap>#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>
        </table>
        <br />
    </cfloop>

<cfelse>

    Error receiving fax status: #ResultCode#

</cfif>
</cfoutput>