Shipping Links

If your company ships products, a quick but high value update you can do to Salesforce as a System Administrator is add links to your page layouts to track your packages via DHL, FedEx or UPS.

Tracking Links on Page Layout

You create the links by going to the object where you would like to place the links. In our example we are using Opportunities, so you would navigate to Setup > App Setup > Customize > Opportunities > Buttons and Links, and then click the “New” button in the “Custom Buttons and Links” section on the right side of the page.

Opportunity Buttons and Links

In our example we’re selecting:

  • Display Type – “Detail Page Link”
  • Behavior – “Display in new window”
  • Content Source – “URL”

Here is the Code for DHL:

http://www.dhl.com/content/g0/en/express/tracking.shtml?brand=DHL&AWB={!Opportunity.Tracking_Number__c}%0D%0A

Here is the Code for FedEx:

http://www.fedex.com/Tracking?ascend_header=1&clienttype=dotcom&cntry_code=us&language=english&tracknumbers={!Opportunity.Tracking_Number__c}

Here is the Code for UPS:

http://wwwapps.ups.com/WebTracking/track?HTMLVersion=5.0&loc=en_US&Requester=UPSHome&WBPM_lid=homepage%2Fct1.html_pnl_trk&trackNums={!Opportunity.Tracking_Number__c}&track.x=Track

NOTE: The code that I generated for these examples were for the United States. You might have to tweak the URL string for another country.

Lastly, you’ll need to go to the page layout for that object and drag the links into the Custom Link section of the page for the new links to display.

Drag Links onto the Page Layout

That’s it!

Another method to accomplish the above would be to create a picklist next to your tracking number called “Shipping Method” so that the user could select the shipping carrier. Then you could use a Formula field (output is Text format) to create a link to the right carrier’s website based on the “Shipping Method” selected by the User. This piece of code assumes the tracking number field is called “Tracking Id”:

CASE(Shipping_Method__c,"Fedex", HYPERLINK("http://www.fedex.com/Tracking?ascend_header=1&clienttype=dotcom&cntry_code=us&language=english&tracknumbers= "&tracking_id__c,"Track"),"UPS", HYPERLINK("http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion=5.0&sort_by=status&loc=en_US&InquiryNumber1= "& tracking_id__c & "&track.x=32&track.y=7″, "Track") ,"DHL", HYPERLINK("http://track.dhl-usa.com/TrackByNbr.asp?ShipmentNumber=" & tracking_id__c,"Track"), "")

If you want to learn more about custom links in Salesforce you can see this tutorial about creating custom links to make dynamic reports.

This entry was posted in Administration. Bookmark the permalink.