Hi David
That part concerned me, did not seem correct but I was going off some code from working scripts that I had access to. I wound up changing it to just a GetObject statement. Part of my issue is that I only do scripting from time to time and my training in Basic is from 1984.. I find the fine points of the syntax in VB to be a bit of a mystery sometimes. I wish I could spend much more time studying it, but in the meantime help from guys like you is invaluable. Here is what I would up with, also
@Alnoor Cassim mentioned that sometimes you need to give the user access to all UDTs. Between these two changes, it seems to be working ok.
'Update Invoice with freight data
'Bob Osborn, ACI 2/2021
'SO_Invoiceheader
'Int Var
scriptName = "invoicefgt"
sSONo = "" : sShipVia = "" : nNoPacK = 0 : sWeight = "" : nFrtAmt = 0
oUDT = oSession.GetObject("CM_UDTMaint_bus", "SO_UDT_SOTRACKING")
If oUDT = 0 Then
oScript.DebugPrint("Failed to get SO_UDT_TRACKING")
oScript.DebugPrint(oBusObj.LastErrorMsg)
oScript.DebugPrint("Exiting script: " & scriptName)
Exit Sub
End If
If oUDT <> 0 Then
Set oUDT = oSession.AsObject(oUDT)
Else
sMsg = "Error: Could not access SO_UDT_UDT_SOTRACKIING" & vbCRLF & _
"If UDT was added to Desktop, add permissions in Role Maint / 'Task / Custom Office."
retMsg = oSession.AsObject(oSession.UI).MessageBox("", sMsg)
Exit Sub
End If
RetVal = oBusObj.GetValue("SalesOrderNo$", sSONo)
'retMsg = oSession.AsObject(oSession.UI).MessageBox("", sSONo)
retVal = oUDT.Find(sSONo)
retVal = oUDT.GetValue("UDF_SHIPVIA$", sShipVia)
retVal = oUDT.GetValue("UDF_FREIGHTAMT", nFrtAmt)
retVal = oUDT.GetValue("UDF_NOOFPACKAGES",nNoPack)
retVal = oUDT.GetValue("UDF_WEIGHT$", sWeight)
retVal =oBusObj.SetValue("FreightAmt", nFrtAmt)
retVal =oBusObj.SetValue("ShipVia$", sShipVia)
retVal =oBusObj.SetValue("NumberofPackages", nNoPack)
retVal =oBusObj.SetValue("ShipWeight$", sWeight)
------------------------------
Bob Osborn
Consultant
ACI Consulting
------------------------------
Original Message:
Sent: 02-16-2021 00:19
From: David Speck II
Subject: error 88 in oSession.AsObject per user
The reason you get the hard error is because you are combining the AsObject and the GetObject on one line without actually being able to test that the value returned by GetObject is a valid object handle.
What I do is initialize the variable to a 0 and then use just GetObject to assign the numeric object handle to the variable. I then check that the variable is not equal to 0 and if it isn't, proceed with the Set statement and AsObject. If you want to properly drop your object when you are done with it, you should use two different variables, a numeric one used with GetObject, such as prefixed with an "n" and then another variable to be used with AsObject, such as prefixed with an "o". Then once you are done with your object, you can call oSession.DropObject [numeric variable for object].
I have a recent post on sage city that explains a few reasons I use a different variable for each object method too.
https://www.sagecity.com/support_communities/sage100_erp/f/sage-100-business-object-interface/159332/print-to-pdf-and-electronically-deliver-sales-order-via-boi/416735#416735
------------------------------
David Speck II
Tennessee Software Solutions
------------------------------
Original Message:
Sent: 02-15-2021 23:21
From: Robert Osborn
Subject: error 88 in oSession.AsObject per user
HI Alnoor,
Thanks, I will give it a try.
Thank you,
Bob Osborn
ACI Consulting
p 714.282.0378 ext. 402 f 714.282.0235
Bob@ACIconsulting.com

This communication, including attachments, is confidential and may contain proprietary information intended only for the proposed recipient. Please notify the sender and delete this message if you believe that you have received this message in error or if you are not the proposed recipient. Unauthorized disclosure, copying, or distribution of the information is strictly prohibited.
Original Message:
Sent: 2/15/2021 10:20:00 PM
From: Alnoor Cassim
Subject: RE: error 88 in oSession.AsObject per user
In Role Maintenance do you see multiple UDTs? If so you might have run into an old bug where one type of workaround is give access to all the UDTs. Try it and if it works then give access to only your Tracking UDT and the very 1st one you.
---------------------------------
Alnoor Cassim
Email: alnoor@asifocus.com
Ph: 949-689-9887
Orange County, CA