Solved

Displaying Shipment Tracking Information in Coldfusion

Posted on 2014-11-11
7
132 Views
Last Modified: 2014-11-15
Order HistoryFedEx Tracking Information
Hi,
  I have a CFM page where I display order information along with tracking number. When I click "TrackingNo" field, I would like to display tracking information provided by FedEx website based on the tracking number in the Order Listing Form/CFGRID.
  Below is my actual CFM code and FedEx URL.
 How can I modify current code to display tracking information from FedEx website when the user clicks "TrackingNo" from the CFGRID?
 
https://www.fedex.com/fedextrack/WTRK/index.html?action=track&action=track&tracknumbers=123456789&fdx=1490
 
<cfform action = "#CGI.SCRIPT_NAME#">
    <cfgrid name = "FirstGrid" width = "900"
            query = "GetOrderHistory" colheaderbold="Yes"
            font = "Tahoma" rowHeaders = "No"
            selectColor = "Red" selectMode = "Edit" format="HTML" > 
        <cfgridcolumn name="StoreID" header="StoreID" width=70>
        <cfgridcolumn name = "TrackingNo" header = "TrackingNo" Select="No" width="150" textcolor="blue" bold="Yes"> href="ShippingInfo.cfm" hrefkey="ID">
        <cfgridcolumn name = "Location" header = "Location" Select="No" width="200" bold="Yes">
        <cfgridcolumn name="City" header="City" width=100>
    </cfgrid>
    <br>
    <cfinput type="submit" name="gridEntered">
</cfform>
0
Comment
Question by:sglee
  • 3
  • 2
  • 2
7 Comments
 
LVL 25

Expert Comment

by:dgrafx
ID: 40437663
Do you mean you want to display a Fedex page like shown above on your website?
Investigate their webservices here: http://www.fedex.com/us/web-services/
0
 

Author Comment

by:sglee
ID: 40437697
@dgrafx
my goal, when the user clicks the link(FedEx tracking#), is to go to FedEx website and display what they provide.
It is just like you and I go to FedEx.com and enter the tracking number to display shipping status.
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 40437717
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 40438904
I don't use cfgrid much - but AFAIK, there's no simple way to make that happen. Honestly the CF ajax stuff is a bit of a pain to extend and workarounds for CF8 won't necessarily work in 9 or 10. Anyway, the closest I could get to "simple" is this (tested w/CF10).

Note: MUST set appendKey="false" or the javascript won't work

<script type="text/javascript">
	function displayFedexPage() {
                // get reference to grid
		var grid = ColdFusion.Grid.getGridObject('FirstGrid');
               // if something is selected
		if (grid.getSelectionModel().hasSelection()) {
                    // get selected row
		   var row = grid.getSelectionModel().getSelected();
                   // get value in tracking number value
		   var trackingNo = row.get('TRACKINGNO');
                   // go to fedex tracking page
		   window.location.href = "http://www.fedex.com/Tracking?action=track&tracknumbers="+ trackingNo;
		}
	}
</script>
<cfform action = "#CGI.SCRIPT_NAME#">
    <cfgrid name = "FirstGrid" width = "900"
            query = "GetOrderHistory" colheaderbold="Yes"
            font = "Tahoma" rowHeaders = "No"
            selectColor = "Red" selectMode = "Edit" format="HTML"
	    appendKey="false">
        <cfgridcolumn name="StoreID" header="StoreID" width=70>
        <cfgridcolumn name = "TrackingNo" header = "TrackingNo" 
			href="javascript:displayFedexPage()"
			hrefKey="TrackingNo"
			Select="No" width="150" textcolor="blue" bold="Yes"> 
        <cfgridcolumn name = "Location" header = "Location" Select="No" width="200" bold="Yes">
        <cfgridcolumn name="City" header="City" width=100>
    </cfgrid>
    <br>
    <cfinput type="submit" name="gridEntered">
</cfform> 

Open in new window

0
 

Author Comment

by:sglee
ID: 40444495
@agx_
I just tried it and it worked great!  That is exactly what I wanted to do.
Thank you very much!
0
 
LVL 52

Expert Comment

by:_agx_
ID: 40444593
Glad it helped.

( I'd thought using href and hrefKey would do it, but CF doesn't allow you to set the URL parameter name, so that doesn't quite cut it.  This is such a common need. You'd think it would be simpler ;-)
0
 

Author Comment

by:sglee
ID: 40444711
I agree and again thank you.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question