Sage 100

 View Only
  • 1.  SO Invoice Type Column Post Validate script fills ARDivisionNo & CustomerNo, but doesn't unlock 'Apply to Inv Number'

    Posted 05-23-2022 18:27
    Edited by Dan Burleson 05-23-2022 18:54
    I am trying to automate the C/M process and would like to fill the 'Apply to Inv Number' field after having manually selected InvoiceType = "CM" and used an InvoiceType Column Post Validate script to set the ARDivisionNo & CustomerNo (which works), but unlike the equivalent manual entry, the field remains locked.

    I tried invoking a server button script that called oUIObj.HandleScriptUI() after setting ARDivisionNo & CustomerNo, but no glory. Does anyone have an idea how this could work?

    ------------------------------
    Dan Burleson
    Software Consultant
    Connex Software
    ------------------------------


  • 2.  RE: SO Invoice Type Column Post Validate script fills ARDivisionNo & CustomerNo, but doesn't unlock 'Apply to Inv Number'

    Posted 05-23-2022 21:45
    I was able to get around this out by invoking a server button script that used:
    retVal = oScript.SetUIControl("APPLYTOINVOICENO", "ENABLE")
    ​


    ------------------------------
    Dan Burleson
    Software Consultant
    Connex Software
    ------------------------------



  • 3.  RE: SO Invoice Type Column Post Validate script fills ARDivisionNo & CustomerNo, but doesn't unlock 'Apply to Inv Number'

    Posted 05-24-2022 10:18
    Edited by David Speck II 05-24-2022 10:18
    Did you try using oSession.AsObject(oScript.UIObj).InvokeChange on ML_Customer if oScript.UIObj is not equal to 0 in your table script (falling back to oBusObj.SetValue if it is equal to 0)?

    Alternatively, did you try [oSession.AsObject(oScript.UIObj).SetControlProperty "ApplyToInvoiceNo", "Enabled", 1] if oScript.UIObj is not equal to 0 in your table script?

    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------



  • 4.  RE: SO Invoice Type Column Post Validate script fills ARDivisionNo & CustomerNo, but doesn't unlock 'Apply to Inv Number'

    Posted 05-24-2022 14:50
    Thanks David. I've been playing with your suggestion of [r = oSession.AsObject(oScript.UIObj).InvokeChange("ML_Customer", "ABC")] with a company w/o divisions. Since there's no screen field for ARDivisionNo:
    1. If I set it to just "ABC" I get the error "The division number must be numeric"
    2. If I set it to "00-ABC" I get the error "The customer number contains an illegal character"
    3. If I set it to "00ABC" It thinks I want to create a new customer record with the customer number of "00ABC"
    4. I also tried to preceded the InvokeChange with a setting of the division number in the table: [r = oBusObj.SetValue("ARDivisionNo$", "00")], but get the same "must be numeric" error on the InvokeChange.
    Someday I'll need this, but for now I've switched my idea to enabling the SalesOrderNo field to repurpose it for C/M's so I don't require a UDF to input it. Once it's enabled, I'm using a Pre Validate event to grab the SalesOrderNo, lookup the related invoice in history, set the customer, division, ApplyToInvoiceNo, and then clear SalesOrderNo w/SetError) This all works, but only if I enable SalesOrderNo from a button click with the statement [r = oScript.SetUIControl("SALESORDERNO", "ENABLE")]. It doesn't work if I invoke the same button from a UDS with [r = oScript.InvokeButton("BT_LINK_1")]. I get the same return code (0) and no oScript.LastErrorMsg in both cases, it just doesn't enable the field unless I use an actual Button. (???)

    ------------------------------
    Dan Burleson
    Software Consultant
    Connex Software
    ------------------------------



  • 5.  RE: SO Invoice Type Column Post Validate script fills ARDivisionNo & CustomerNo, but doesn't unlock 'Apply to Inv Number'

    Posted 05-24-2022 15:29
    Is the "not numeric" message accompanied with a returned value indicating failure or a warning?  I usually don't worry about the not numeric messages unless I know for a fact the field is restricted to numeric values.

    Have you tried oSession.AsObject(oScript.UIObj).ChangeML_Customer() after doing oBusObj.SetValue on ARDivisionNo and CustomerNo?

    Did you test the oSession.AsObject(oScript.UIObj).SetControlProperty method?

    If all else fails, sounds like you just need to defer the enabling of the control.  One way to do this without the extra button is using the UI object SetVar method on the CMD_STR$ variable with the X prefix indicating everything that follows is to be executed.
    oSession.AsObject(oScript.UIObj).SetVar "CMD_STR$", "X _obj'SetControlProperty(""ApplyToInvoiceNo"", ""Enabled"", ""1"")"​


    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------



  • 6.  RE: SO Invoice Type Column Post Validate script fills ARDivisionNo & CustomerNo, but doesn't unlock 'Apply to Inv Number'

    Posted 05-24-2022 15:35
    Also, the InvokeChange approached worked from the console and enabled the apply to invoice no field and also gave me the "is not numeric" message but the returned value was a 1.


    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------



  • 7.  RE: SO Invoice Type Column Post Validate script fills ARDivisionNo & CustomerNo, but doesn't unlock 'Apply to Inv Number'

    Posted 05-24-2022 15:55
    Lastly, with divisions disabled, I found that InvokeChange on ML_Customer does still expect the division number to be passed to it. 

    The following failed.

    But this was successful.

    It did not accept it with a dash separating the division and customer number.


    ------------------------------
    David Speck II
    Tennessee Software Solutions
    ------------------------------



  • 8.  RE: SO Invoice Type Column Post Validate script fills ARDivisionNo & CustomerNo, but doesn't unlock 'Apply to Inv Number'

    Posted 05-24-2022 19:37
    Thanks again David. I went back and re-checked my results and I must have had a typo on the "00ABC" because it worked this time and before, when I got the message about creating a new customer "00ABF",(maybe?) I didn't recognize a typo in the customer number.

    I had tried the SetControlProperty. That didn't work but the SetVar with the CMD_STR$ variable did work. Thank you trice!


    ------------------------------
    Dan Burleson
    Software Consultant
    Connex Software
    ------------------------------