Tracking number lookup and link to web site ship24

SOLVED

Do to the fact that iShip is no longer working, I've created an invoice tracking number script, but it is not returning the tracking number.  What am I doing wrong?

Thanks,

John

Here is the script.

'******* 1/13/2023 Tracking number lookup and link to web site ship24 *******

If oSession.CompanyCode = "ABC" Then

retval = oSession.AsObject(oSession.UI).Messagebox("""Tracking fired")

Div=""
Order=""
InvoiceNo=""
Package=""
TrackingNo=""

retVal = oBusObj.GetValue("InvoiceNo$",InvoiceNo)


msgbox "Invoice=" & Invoiceno


' **** Open Tracking Business Object *********

oTrackingBus = oSession.GetObject("SO_InvoiceTracking_bus")

if oTrackingBus<> 0 then

Set oTrackingBus = oSession.AsObject(oTrackingBus)
retval = oSession.AsObject(oSession.UI).Messagebox( "","oTrackingBus fired")

retval = oTrackingBus.SetKeyValue("InvoiceNo$",InvoicenNo)
retval = oTrackingBus.SetKeyValue("PackageNo$","0001")
retVal = oTrackingBus.SetKey()

retVal = oTrackingBus.GetValue("TrackingID$",TrackingNo)

msgbox "Invoice No = "& InvoiceNo & " Tracking No =" & TrackingNo

TrackingNo="1z91076x0362409304"        '***** testing

Link = "">www.ship24.com/tracking & TrackingNo & ""

msgbox Link

CreateObject("WScript.Shell").Run(Link)
else

retval = oSession.AsObject(oSession.UI).Messagebox( "","oTrackingBus failed")

end if


End if 'Close if not ABC company

Parents
  • 0
    SUGGESTED

    I could not get the tracking number from the grid in the Tracking number screen, so I created a script in the Invoice History Inquiry screen next to the existing Tracking number button that links to ship24. I hard coded the header sequence number to "000000" and the package number to "0001". A more elaborate script would check to see if the invoice has any tracking numbers and it could loop through the packages and give the user the option to display all the tracking numbers or just the first one, but I chose the faster, non-elegant approach to start with.

  • 0 in reply to Sage100User
    SUGGESTED

    This works.

    Mas_Scr_Dbg = 0

    'If oSession.CompanyCode = "ABC" Then

    retval = oSession.AsObject(oSession.UI).Messagebox("""Tracking fired")

    Div=""
    Order=""
    InvoiceNo=""
    HedSeqNo=""
    Package=""
    TrackingNo=""

    retVal = oBusObj.GetValue("InvoiceNo$",InvoiceNo)
    retVal = oBusObj.GetValue("HeaderSeqNo$",HedSeqNo)
    retVal = oBusObj.GetValue("PackageNo$",Package)
    retVal = oBusObj.GetValue("TrackingID$",TrackingNo)
    'msgbox "Invoice=" & Invoiceno & " SeqNo = " & HedSeqNo & " Package = " & package & " Tracking = " & TrackingNo

    Link = "">www.ship24.com/tracking & TrackingNo & ""

    'msgbox Link

    CreateObject("WScript.Shell").Run(Link)

    'End if 'Close if not ABC company

Reply
  • 0 in reply to Sage100User
    SUGGESTED

    This works.

    Mas_Scr_Dbg = 0

    'If oSession.CompanyCode = "ABC" Then

    retval = oSession.AsObject(oSession.UI).Messagebox("""Tracking fired")

    Div=""
    Order=""
    InvoiceNo=""
    HedSeqNo=""
    Package=""
    TrackingNo=""

    retVal = oBusObj.GetValue("InvoiceNo$",InvoiceNo)
    retVal = oBusObj.GetValue("HeaderSeqNo$",HedSeqNo)
    retVal = oBusObj.GetValue("PackageNo$",Package)
    retVal = oBusObj.GetValue("TrackingID$",TrackingNo)
    'msgbox "Invoice=" & Invoiceno & " SeqNo = " & HedSeqNo & " Package = " & package & " Tracking = " & TrackingNo

    Link = "">www.ship24.com/tracking & TrackingNo & ""

    'msgbox Link

    CreateObject("WScript.Shell").Run(Link)

    'End if 'Close if not ABC company

Children
  • 0 in reply to jryals

    Not having luck with script.  I made a button in Customizer, linked to VBS file, executed on client.  I get a MSScript Link Error box that says

    OLE Error Number : 424

    Description : Object required: 'oSession'

    Language : VBScript

    Script Line : 30

    Script Column : 0

    If anyone knows what I'm doing wrong I'd appreciate any feedback. Also I did this on the Sales Order & Quote History MAIN panel as thats where the previous tracking button  was that our customer service people used.

  • 0 in reply to TMC

    Scripts run from the client don't have access to business objects.  Passing values into such button scripts has to be done differently.