Solved

Displaying Shipment Tracking Information in Coldfusion

Posted on 2014-11-11
7
124 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now