Solved

Displaying Shipment Tracking Information in Coldfusion

Posted on 2014-11-11
7
136 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
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

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.

Question has a verified solution.

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

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

738 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