Sage 100

 View Only
Expand all | Collapse all

I'm working on a User Defined Script in the the Sa

Dan Burleson

Dan Burleson11-17-2011 15:52

  • 1.  I'm working on a User Defined Script in the the Sa

    Posted 11-17-2011 14:00
    I'm working on a User Defined Script in the the Sales Order Detail. Anybody know if there is quick way to check the product line of the current item directly from the business object? I can run a query to read the product line from the CI_item file but it's a little slow. User has to wait for the focus to return to the UI.


  • 2.  RE: I'm working on a User Defined Script in the the Sa

    Posted 11-17-2011 14:08
    First - Put a UDF on the So Detatil table and make it reference the Product Line from CI_Item (too bad this field wasn't in the standard table. Second - Use the lines object to read the UDF: Set oSS_Script = oSession.AsObject(oSession.ScriptObject) Set oLines = oBusObj.AsObject(oBusObj.Lines) retVal = oLines.GetValue(""UDF_MY_PRODUCT_LINE$"", strProdline)


  • 3.  RE: I'm working on a User Defined Script in the the Sa

    Posted 11-17-2011 14:13
    Yep...that will work. Thanks Myron. I still keep thinking there's some ""hidden"" object that would reference the product line. They even include it as an informational field on the secondary grid, oh well, yes it's too bad they don't put it on the standard table.


  • 4.  RE: I'm working on a User Defined Script in the the Sa

    Posted 11-17-2011 15:35
    Yes, you can get to it directly in the Sales Order Detail BO: strProdline = """" retVal = oBusObj.GetValue(""ITEM.PRODUCTLINE$"", strProdline)


  • 5.  RE: I'm working on a User Defined Script in the the Sa

    Posted 11-17-2011 15:50
    That's what I was looking for, thanks Dan! I knew there had to be a connection. Now, does a document(s) exist that lists what objects are available where?


  • 6.  RE: I'm working on a User Defined Script in the the Sa

    Posted 11-17-2011 15:52
    There is the source code.


  • 7.  RE: I'm working on a User Defined Script in the the Sa

    Posted 11-17-2011 15:55
    Interesting. Probably all tables used by the object can be accessed, like CI_Item and others.


  • 8.  RE: I'm working on a User Defined Script in the the Sa

    Posted 07-15-2015 10:37
    @DanBurleson way back in the day you showed me this: strProdline = """" retVal = oBusObj.GetValue(""ITEM.PRODUCTLINE$"", strProdline) For getting at inventory data while in SO_SalesOrderDetail, etc. Is there a similar open object for vendor info when in AP_InvoiceHeader? I tried ""vendor.UDF_UDFNAME$"", didn't seem to work.


  • 9.  RE: I'm working on a User Defined Script in the the Sa

    Posted 07-15-2015 11:19
    Not sure if you his helps but there's an actual GetDataSources() method you can call. An easier visual way is to go into UDF Maintenance choose SO Sales Order Detail, create a pretend UDF, choose Business Object, then look at the Data Sources drop down. You can think of these as pre-linked tables.


  • 10.  RE: I'm working on a User Defined Script in the the Sa

    Posted 07-15-2015 11:29
    I'm sure that could work. I've got it working right now by doing an ADO connection. Works fine , but probably slower that the built-in methods. I'm running script on the Post_validate of an AP_InvoiceHeader field and want to reference a Vendor UDF. I assume the Vendor data source is available at that time. In Dan's example i was able to get at CI_Item fields by using ITEM.<fieldname> i thought in this context it might just be VENDOR.<fieldname>.


  • 11.  RE: I'm working on a User Defined Script in the the Sa

    Posted 07-15-2015 14:07
    You could also source an AP InvoiceHeader UDF from your AP Vendor UDF and refer to it as a local oBusObj field.


  • 12.  RE: I'm working on a User Defined Script in the the Sa

    Posted 07-15-2015 18:19
    Yeah Dan that would work. Never even occurred to me. Thanks.


  • 13.  RE: I'm working on a User Defined Script in the the Sa

    Posted 07-16-2015 06:52
    Alnoor, to follow up on the Data Source idea, for my own edification at this point. Do I need to use ReadAdditional() to load the associated record? If so, how do I then use a GetValue to get the data in a specific file? I've tried a few things but no luck. Just trying to get VendorName in this test scenario.


  • 14.  RE: I'm working on a User Defined Script in the the Sa

    Posted 07-16-2015 09:10
    @AlnoorCassim never mind, i figured it out. Thanks!


  • 15.  RE: I'm working on a User Defined Script in the the Sa

    Posted 07-16-2015 09:20
    I was just about to post this: strAPDivNo = """" : strVendor = """" : strVendorName = """" Set oVendor = oBusObj.AsObject(oBusObj.GetChildHandle(""VendorNo"")) retVal = oBusObj.GetValue(""ITEM.PrimaryAPDivisionNo$"", strAPDivNo) retVal = oBusObj.GetValue(""ITEM.PrimaryVendorNo$"", strVendor) retVal = oVendor.Find(strAPDivNo & strVendor) 'null padding not needed in this case retVal = oVendor.GetValue(""VendorName$"", strVendorName) sMsg = ""Primary Vendor = "" & strVendorName retMsg = oSession.AsObject(oSession.UI).MessageBox("""", sMsg)


  • 16.  RE: I'm working on a User Defined Script in the the Sa

    Posted 07-16-2015 09:26
    Thank you, Alnoor. I'll look it over and see what pearls of wisdom I can pull out of it!