Sage 100

 View Only
Expand all | Collapse all

File under #YASP (Yet another #scripting problem).

William Schlageter

William Schlageter09-26-2012 07:49

  • 1.  File under #YASP (Yet another #scripting problem).

    Posted 09-17-2012 17:35
    File under #YASP (Yet another #scripting problem). The following code runs fine on my machine when run from a button link script, set to run at server in MAS90: On another machine (with the same MAS_CMP data file) the ""Set oTracking = ..."" line throws an OLE error 13 about a type mismatch. If we use a different business object (say ""AR_Customer_Bus"") the script runs fine on both machines. @DanBurleson, @AlnoorCassim, other #ScriptingExperts. I'm not even sure where to look from here... Thanks in advance.


  • 2.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-17-2012 17:44
    Set oTracking = oSession.AsObject(oTracking) - Is this redefining oTracking? Was it previously defined?


  • 3.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-17-2012 17:47
    @MyronStevenson: That was just a typo. It's fixed now in SocialCast -- still have the problem though.


  • 4.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-17-2012 19:58
    This works fine on my PC too. However I'd add oTracking = 0 right after hTracking = 0 (to dimension all variables). I'd also double check that Allow External Access is checked in Company Maintenance.


  • 5.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-18-2012 03:56
    Just spit balling here... oSession.GetObject(""AR_InvoiceHistoryTracking_BUS"") is supposed to return the the object handle for AR_InvoiceHistoryTracking_BUS. If that object is not instantiated, or not in scope, then it is not going to be found. Check the value of hTracking after this call. I would hazzard a guess to say that when this code works, hTracking has a non-zero value and a zero value when it fails.


  • 6.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-18-2012 06:30
    I'm not a script daddy like Dan or Alnoor but we ran into an issue when the user running the script did not have rights to the object to reference. Is the issue machine specific or user specific? We also had issues where a script ran fine on an XP machine but not on a Win7 box. We were using an older call for message box. By using another function, it worked fine. As I said, I'm more of script kiddie, taking parts of programs written by others. I don't always understand all the details of the tools, just that they work when I put them together.


  • 7.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-18-2012 10:16
    My money is on Shawn's track. Have you isolated it to another user (MAS and network) or just another machine/OS?


  • 8.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-18-2012 12:46
    It is working on my machine (Windows 7) but not on another machine (Windows XP). Would this be a bug that I should report, or is it more a version of WScript/CScript?


  • 9.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-18-2012 12:52
    What about the network and Sage 100 logins? Are they the same in both environments?


  • 10.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-18-2012 12:55
    @AaronClark when the error message provides you a line reference, are you determining what line it is referencing in your original code of through the info button? My best guess is that there is a VB Script call you are using that will run under Win7 and that is not supported on the XP box. This is either due to a .NET version or something with the base OS.


  • 11.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-19-2012 06:49
    What is the value of oSession.LastErrorMsg after the GetObject call?


  • 12.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-19-2012 13:04
    @WilliamSchlageter -- LastErrorMsg = 0 @ShawnSlavin -- that's what I'm leaning toward too, but that doesn't make sense when I am instantiating an object that is provided by Sage, unless the implementations of the oSession object are different between operating systems. @DanBurleson -- The network and Sage 100 logins are different. I'll have to give that a try and see if anything is different. I'm currently dealing with three different installations of MAS. Thanks for your help!


  • 13.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-19-2012 15:36
    I tested this script with my ABC company (with Sales Order) and it worked fine. I then tested it with my XYZ company (without Sales Order activated) and I got the same error 13 that you got. Is it possible that other install cannot see AR_InvoiceHistoryTracking_BUS?


  • 14.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-19-2012 18:54
    What is the value of hTracking when it gets back from this line? hTracking = oSession.GetObject(""AR_InvoiceHistoryTracking_BUS"") When it fails and when it succeeds...


  • 15.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-19-2012 19:45
    Failure: hTracking = 0 Success: hTracking = 10019 (or something like that) What do you have in mind? Sent via DroidX2 on Verizon Wireless


  • 16.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-20-2012 04:33
    A value of 0 indicates that the business object AR_InvoiceHistoryTracking_BUS is not initialized. There are quite a few places in the system where the AR_InvoiceHistoryTracking table is opened, read and written to, especially SO sales journal update, (this is not uncommon in Mas and is done largely for perfomance), but only one place where this business object is instantiated and that is from the creation of AR_InvoiceHistoryTracking_UI - not sure how this helps, but I am quite sure your problem is NOT OS or 90 vs 200 related.


  • 17.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-20-2012 04:51
    I'm surprised that LastErrorMsg is not giving you anything. Have you trying different companies (such as ABC) on the MAS install where it is failing (like Michael is suggesting above)? Or making sure to use a user that has all role rights to rule out a security setting?


  • 18.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-20-2012 06:47
    are you printing oSession.LastErrorMsg ? I ask because you report a '0' and this value should be a string....


  • 19.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-20-2012 15:42
    @RandyMarion: I was printing LastErrorMsg, and it was returning a 0 on one of the workstations where this does not work. @WilliamSchlageter: We've tried all of those, and no dice.


  • 20.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-20-2012 16:11
    Maybe its time to look at this from another angle ... not sure what you want to do with this particular business object, but if it is only for reading data, why not new up the service object? Something like ... Set oTracking = oPVX.NewObject(""AR_InvoiceHistoryTracking_svc"", oSession) I doubt you can drop this right into your code, but you get the idea...


  • 21.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-20-2012 16:18
    That might work. It's an inelegant hack, but if it works... I'll keep you posted.


  • 22.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-20-2012 16:31
    Did you ever eliminate the network and MAS login differences?


  • 23.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-20-2012 17:34
    @DanBurleson: That has been eliminated as a possibility.


  • 24.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-24-2012 10:04
    Found out that the customer is running 4.40.0.0 -- turns out that we can reproduce the issue on a machine running 4.40.0.0, but we have no problems on a machine running 4.40.0.5... We'll be updating things as this progresses.


  • 25.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-26-2012 07:31
    You mean 4.40.0.4? I thought I missed a new PU for a minute. :)


  • 26.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-26-2012 07:37
      |   view attached
    @WilliamSchlageter, ummm... maybe you did? Or are you thinking 4.5?


  • 27.  RE: File under #YASP (Yet another #scripting problem).

    Posted 09-26-2012 07:49
    Yes, I screwed up.