Is DeactivateProcedure usable on external scripts?

SOLVED

I've used DeactivateProcedure on scripts running within Sage, but not on external scripts.  I'm working on a script that requires me to disable procedures in SO Entry.  I've tried a few variations, but I'm getting "Object doesn't support this property or method."  So I'm sure I don't have the right syntax.  Any suggestions?

Set oSO = oScript.NewObject("SO_SalesOrder_bus", oSS)

'I've tried the below (and many other variations):


retVal = oSO.AsObject(oSO.ScriptObject).DeactivateProcedure("*ALL*") 'doesn't work
retVal = oSO.nDeactivateProcedure("*ALL*") 'doesn't work

  • +1
    verified answer

    If this is an external script, then I don't believe you should even be able to use AsObject and you need to prefix the properties and methods with the data type.  So you should try something like this.

    If oSO.nScriptObject <> 0 Then
        oSO.oScriptObject.nDeactivateProcedure "*ALL*" 
    End If
     

    Generally though, I would advise against deactivating ALL procedures as if there is one or more scripts in play, they may have a reason to do something specific.  But if you are doing something like an additional read or write and need to prevent recursion, then it would be appropriate.  Something else you can leverage is the RefCount property of the script object that you can check at the beginning of any scripts to make sure the script only executes when RefCount is equal to 1.

  • 0 in reply to David Speck

    Noted.  Thank you for your expertise.  And this solution worked! 

  • 0 in reply to n0tgunshy2

    Hi n0gunshy2, great to see that the community helped you figure out a solution!Tada

    If you have a minute, tell us about your great experience on Sage City, take this short survey