Is it possible to access the tracking url of a par...
# suitescript
k
Is it possible to access the tracking url of a particular tracking number from the Package Tracking Number field in an Item Fulfillment's Package sublist?
e
I could be wrong, but I don’t believe that is stored anywhere in the database. I think it’s calculated automatically when you view the transaction in NetSuite. We build our own tracking links when we send emails based on the prefix of the tracking number.
k
thank you for response! could you share how you create your own tracking links?
e
After looking back at the code, I see that we’re not actually using the prefix in NetSuite. That must have been our old system. Now, we are use the carrier type and we use a little function like the one below to get the tracking URL and then just append the actual tracking number on the end.
Copy code
function trackingURL(carrier) {
        var url;
        switch(carrier) {
            case "UPS":
                url = "<http://wwwapps.ups.com/etracking/tracking.cgi?TypeOfInquiryNumber=T&InquiryNumber1=>";
                break;
            case "FEDEX":
                url = "<http://fedex.com/Tracking?ascend_header=1&clienttype=dotcom&cntry_code=us&language=english&tracknumbers=>";
                break;
            case "DHL":
                url = "<https://webtrack.dhlglobalmail.com/?trackingnumber=>";
                break;
            default:
                url = "<http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?strOrigTrackNum=>";
        }
        return url;
    }
Depending on your own carriers, you might have to change this up a bit.
k
this is awesome, thank you!
👍 1