Can you trigger a script to open Customer Inquiry when clicking on Totals tab in SO Invoice Data Entry?

SOLVED

I am not well versed in scripting, but I know it can do a lot of wonderful things.  I'm hoping this will be possible.

I have a customer that creates credit memos but they do not always apply them.  They would like a way to checking their customer's invoices at the time they are doing invoices.

I was thinking there might be a way of triggering the Customer Inquiry screen (opened to the Invoices tab for the customer being invoiced) when you go to the Totals tab in SO Invoice Data entry, sort of the way it works when you click on the Customer button from Invoice Data entry.

If it can't be done when going to the totals tab, maybe I can create a button that would trigger it?
Is it possible? 

Parents Reply
  • 0 in reply to TomTarget

    Great point!  However, I tried to explain this already but "it's an extra step".  This customer is coming from Peachtree where you get prompted to apply credit memos at the time of invoicing.  Unfortunately, they are a bit set in their ways so I was trying to find something for them that's similar.  

Children
  • 0 in reply to Javier Guzman
    SUGGESTED

    Easiest way is to set up a PreTotals script (filtered to SO Invoice Entry) to invoke the pHeader button, then that CustomerNo button.  If you've never scripted in Sage 100 before, writing a query as I mentioned above is probably not a good place to start.

  • 0 in reply to Kevin M

    Excellent, that's where I'm headed now.  Thank you so much Kevin and Tom!  I really appreciate your input.

  • 0 in reply to Kevin M

    Excellent idea Kevin!   One thing I like about this forum is that putting heads together yields lots of good ideas.   So easy to get stuck on one thought process and not think about others.

  • 0 in reply to Kevin M

    Kevin,

    I tried to do the script (which seems simple enough).  However, the CustomerNo button (opening Customer Maintenance) never fires.  Would you know what I'm missing?  This is the script:

    retVal=0

    retVal = oScript.InvokeButton("fldr.pHeader")
    Set oUIObj = oSession.AsObject(oScript.UIObj)
    retVal = oScript.InvokeButton("BT_ML_CUSTOMERNO")
    retVal = oUIObj.HandleScriptUI()
    retVal = oScript.InvokeButton("fldr.pTotals")

    Many thanks in advance,

    Javier

  • 0 in reply to Kevin M

    Ok, I figured it out (almost completely).  Probably not the prettiest, but it works for now.  Sharing in case anyone may need it or something similar.

    oARCust = 0
    DivNo = 0
    CustNo = ""
    CustNumber = ""

    oARCust = oSession.GetObject("AR_Customer_UI")
    retVal = oBusObj.GetValue("ARDivisionNo$",DivNo)
    retVal = oBusObj.GetValue("CustomerNo$",CustNo)
    CustNo = Cstr(CustNo)

    If DivNo < 10 then
    DivNo = "0" & DivNo
    else
    DivNo
    End if

    CustNumber = DivNo&CustNo

    if oARCust <> 0 then
    Set oARCust = oSession.AsObject(oARCust)
    retVal = oARCust.Process(CustNumber)
    retVal = oScript.InvokeButton("AR_Customer.pInvoice")
    End if

    Now, a follow-up question: If you notice, at the end I have a line to invoke the pInvoice tab on the Customer Maintenance window.  Unfortunately, it doesn't get there - it only opens Customer Maintenance on the main tab.  Any way to force it to go to the Invoice tab?  I'm sure I'm just missing a small piece.  Any help would be greatly appreciated.

  • +1 in reply to Javier Guzman
    verified answer

    Sage 100's scripts can only interact with the UI within the context of it's task. So as soon as you call oARCust.Process, any code after that is not going to execute until you close the "Process"ed task. Which is obviously too late for your requirements. 

    What you can do though is use the oSession's ScriptObject's SetStorageVar method to set a "flag" prior to calling oARCust.Process that can be retrieved using the oSession's ScriptObject's GetStorageVar method in a post load script attached to DMain of the AR_Customer.M4L library panel. If the flag is set, then invoke the pInvoice panel, otherwise do nothing, 

  • 0 in reply to David Speck

    Thanks so much for your input, David!  I will take a look at this right now and report.

  • 0 in reply to David Speck

    David,

    It worked!  Thank you so much for pointing me in that direction.  The only change I made was attaching the post load script to the PMain of AR_Customer, not the DMain.

    Thanks again!