Scripting

Expand all | Collapse all

? Why would this IM_ProductLine object fail with E

David Speck II

David Speck II08-23-2018 15:56

  • 1.  ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 12:45
    ? Why would this IM_ProductLine object fail with Error 88 in a SO Invoice line script? otmpBus = 0 retVal = 0 set otmpBus = oSession.AsObject(oSession.GetObject(""IM_ProductLine_bus""))


  • 2.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 13:13
    1. Are you sure that is a valid class name? 2. Does the error happen for all users? 3. Does the user have the correct role settings for accessing the class (task)? 4. Is ""Allow External Access"" checked for all companies the script will be running under?


  • 3.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 13:20
    Also, I prefer to use a variable initialized with a numeric value to receive the return value from the GetObject method on its own line and on the next line, use an IF...THEN to check if the variable's value is greater than 0, if yes, you can then pass the numeric variable to the AsObject method when setting the object handle to a variable, if not greater than 0, then the object handle could not be returned, you can check the oSession.LastErrorMsg to try to find out why. ``` nProdLineBus = 0 : nProdLineBus = oSession.GetObject(""IM_ProductLine_bus"") If nProdLineBus > 0 Then Set oProdLineBus = oSession.AsObject(nProdLineBus) ' Execute code here Set oProdLineBus = Nothing Else oScript.DebugPrint ""Unable to get object handle: "" & oSession.LastErrorMsg End If ```


  • 4.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 13:37
    Downside of scripting inside the Launcher. In Role Maintenance they don't have access to Product Line Maintenance. If you only need to read info out of there then assign them View Only access to it.


  • 5.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 13:43
    User is adm (all access) role. External is ON. Happens all users. Role maint for ProductLine is Create/Modify/Remove/View. Oddly, same script is FINE in SO Order Entry lines.


  • 6.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 13:44
    David: Tried separating GetObject & Setting AsObject as suggested - still get the Error 88 for some reason.


  • 7.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 13:49
    Any other scripts on the table? Are you positive the error is occurring in that specific script and line? Could it be another line where you might be referencing a property or method that exists in sales order entry but not invoice data entry?


  • 8.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 13:53
    This is the Only script for SO Invoicing. Would ProductLine object NOT be available to invoicing?


  • 9.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 13:55
    The way you find out the actual security level at time of execution is the SecurityAccess property. r = oBusObj.SecurityAccess If you're script starting point is Header then change oBusObj to oLines Values range from 0 to 7. 0 means no access or an inquiry screen. 7 means all access.


  • 10.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 14:01
    Script for SO_InvoiceDetail initiated from ColumnPostValidate on ItemCode column. Security is 7. Why ProductLine not accessible??


  • 11.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 14:04
    Also I'm not in front of computer but if you're looking at code check SO_InvoiceDetail_bus and SO_CommonEntryDetail for a GetRecord followed by READ DATA from some prefix that refers to Product Line IOL. We're seeing if we can take advantage of what the Sage coder need Product Line for. No guarantees. Pretend that prefix is ProdLine$. That means you don't have to do the GetObject to begin with. Let's say you need SalesAcctKey so you do: tmpSalesAcctKey = """" retVal = oBusObj.GetValue(""ProdLine.SalesAcctKey$"", tmpSalesAcctKey) You can also check if there are child objects or child handles (data sources) pointing to IM_ProductLine_bus


  • 12.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 14:11
    If you are getting error 88, you most likely are referencing a property or method that is not available or not passing the correct parameters to a method. Can you post the full script? Also, it is worth considering the prefix alternative that Alnoor mentioned but I have seen it behave inconsistently, think it is a timing issue but you can always try calling oBusObj.ReadAdditional before the oBusObj.GetValue


  • 13.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 14:59
      |   view attached
    See FAIL line below - full script attached ' Security retval is 7 oProdLine = oSession.GetObject(""IM_ProductLine_bus"") sMsg = ""oProdLine= "" & Cstr(oProdLine) ' successful retMsg = oSession.AsObject(oSession.UI).MessageBox("""",sMsg) If oProdLine = 0 Then Exit Sub ' ' Following line FAILS - eRR 88 ' Set oProdLine = oSession.AsObject(oProdLineBus) '

    Attachment(s)



  • 14.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 15:04
    Do you have a filter to only work with ItemType = 1?


  • 15.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 15:14
    Good point Kevin. In column PreValidation of ItemCode (uncommon), the ItemType has not been set.


  • 16.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 15:19
    Lee did say this was on the post validate at least but checking the item type is a good point. Also Lee, the code you posted has inconsistent variable names used. Try the code I posted inside of a IF...THEN where the item type is ""1"".


  • 17.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 15:32
    By inconsistent, I mean that you refer to oProdLine throughout most of the code but in the AsObject method, you are passing oProdLineBus, which has not previously been given a value. Change it to oProdLine and you should be good.


  • 18.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 15:48
    David I was already aware the script is on PostValidation but mentioning PreValidation or some alternate procedure sometimes triggers people's memories or makes them identify where they could actually could be running from. It may not be applicable here but it shouldn't be dismissed either.


  • 19.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-23-2018 15:56
    Gotcha.


  • 20.  RE: ? Why would this IM_ProductLine object fail with E

    Posted 08-24-2018 05:36
    ItemType = 1 checked early in the script. Succeeded with the product file object. The puzzle is I started with a script that worked fine for Sales Order Lines, but there seem to be different rules running copy of that script for Invoice lines. Thanks for your help.