Scripting

  • 1.  A little birdie once told me (scripting class... t

    Posted 09-12-2017 15:19
    A little birdie once told me (scripting class... txt file in folder 94) that I could use a shortcut in SO / PO detail scripts to reference the Item / PL without any extra objects. `retVal = oBusObj.GetValue(""ProdLine.ProductLineDesc$"", tmpPLDesc)` I've used the Item. syntax many times but tried the ProdLine. shortcut today without it working (SO detail pre-write script in v2016 Standard). Is there a trick to it?


  • 2.  RE: A little birdie once told me (scripting class... t

    Posted 09-12-2017 17:30
    ** Edited ** I edited some of my previous comment and added this. I took a look and in SO_CommonEntryDetail_bus (inherited by SO_SalesOrderDetail_bus) it does a GetRecord / READ DATA combo that should make prodLine$ available to you. I tried it with a button in S/O Entry just now and it seems to work for the item I'm sitting on in the row. If it doesn't work for you tell me where you are firing it off from exactly (Post-Val of ItemCode ?) ProdLine = """" : PLDesc = """" retVal = oLines.GetValue(""item.ProductLine$"", ProdLine) retMsg = oSession.AsObject(oSession.UI).MessageBox("""", ""Prod Line = "" & ProdLine) retVal = oLines.GetValue(""prodLine.ProductLineDesc$"", PLDesc) retMsg = oSession.AsObject(oSession.UI).MessageBox("""", ""PLDesc = "" & PLDesc) --------------------------- Will look at the source code for the SO Detail and PO Detail business objects when I get a chance. If you have access yourself you're looking for the line pairs where 1st one uses GetRecord() function from a table like CI_Item or IM_ProductLine and second uses READ DATA. itemSvc'GetRecord(itemRec$, itemIOL$) READ DATA FROM itemRec$, REC=item$ TO IOL=itemIOL$ This stuffs all the data from each field in the table for the current record into itemRec$ prefixed by item$ and now item$ is available to you in scripting.


  • 3.  RE: A little birdie once told me (scripting class... t

    Posted 09-13-2017 08:36
    Thanks @AlnoorCassim . (The source code references go over my head...). I don't know why it didn't work for me yesterday, but I was able to get the PL description today... yet not the UDF I actually wanted. It's academic at this point. I wanted to give the customer control over the PL's in a line script by using a checkbox in IM_ProductLine, but just hard coded the list into the script instead. Will the ProdLine. shortcut work for UDF's? The attached code brings in the description but the UDF value is blank (when I believe it should return a ""Y"").


  • 4.  RE: A little birdie once told me (scripting class... t

    Posted 09-13-2017 08:54
    If the source code used GetPartialRecord() instead of GetRecord() then only specific columns of data are available to you. I believe it's GetRecord() so in this case your GetValue to UDFs with the ProdLine prefix should work fine. I'll check/test later. Also if you haven't considered it already, remember with checkboxes there are really 3 states: Yes, No, and the infamous blank (if you're on Premium it is empty string as opposed to NULL). So it's possible sMarkupTest is properly holding no value because user had no reason to check the UDF box in Product Line Maint. Ergo if you're checking for sMarkupTest = ""N"" change it to sMarkupTest <> ""Y


  • 5.  RE: A little birdie once told me (scripting class... t

    Posted 09-13-2017 09:06
    I looked at the raw data and while some rows had the UDF values as blank, one should have been ""Y"". (I know to handle blank UDF's... banged my head against that wall enough to have the lesson well learned). Edit: an no rush at all, since I went another direction for the customer script.


  • 6.  RE: A little birdie once told me (scripting class... t

    Posted 09-14-2017 20:35
    Kevin I took a look. Created a checkbox UDF in IM ProductLine called Whatever, added it Prod Line Maint screen, and checked the box for a few of them. Then modified the example and it seems to pick up the ""Y"". So I don't what makes yours different. Good thing you went in another direction. ProdLine = """" : PLDesc = """" : Whatever = """" retVal = oLines.GetValue(""item.ProductLine$"", ProdLine) retVal = oLines.GetValue(""ProdLine.ProductLineDesc$"", PLDesc) retVal = oLines.GetValue(""ProdLine.UDF_WHATEVER$"", Whatever) sMsg = ""PL Desc = "" & PLDesc & vbCrLf & "" Whatever = "" & Whatever retMsg = oSession.AsObject(oSession.UI).MessageBox("""", sMsg)


  • 7.  RE: A little birdie once told me (scripting class... t

    Posted 09-15-2017 06:20
    Thanks for checking! If it comes up again I'll just have to figure it out ""whatever"" the problem is.