Access IM_ProductLine data from an SO detail script

SOLVED

A little birdie whispered a shortcut in my ear once, but it isn't working consistently for me today.  (v2018.2, Standard).

retVal = oBusObj.GetValue("ProdLine.ProductLineDesc$", sPLDesc)

I was able to get results, intermittently, but sometimes they were details from the wrong line!  There is no ChildHandle to grab for Product Line from SO detail... and I need to do a lookup of a UDF value in IM_ProductLine for an SO detail formula.

I've opened a new object (requiring view access to PL Maint), which works for now, but I'm wondering if there is an easier / better way.

Top Replies

  • Hi

    Unfortunately, relying on Sage's internal variables can be a bit of guessing game, as you have found out.  When are you retrieving this value?  Is it a UDF or a the description above?  The…

  • +1
    verified answer

    Hi

    Unfortunately, relying on Sage's internal variables can be a bit of guessing game, as you have found out.  When are you retrieving this value?  Is it a UDF or a the description above?  The most reliable place to retrieve it is in the Post-Read of the line for existing lines.   New lines, however, maybe trickier, because internally Sage isn't retrieving all the product line fields from the table, only the ones it cares about.  So it would probably be more reliable to do what you have done already.

    E

  • 0 in reply to jepritch

    Thanks for the reply Elliott,

    The description field was just a code snippet from an example.  I really want a UDF value in IM_ProductLine for a detail pre-write script (to calculate a detail UDF value based on the IM_PL lookup value and ExtensionAmt).  It has to recalculate amounts when invoicing with back-orders changing the line ExtensionAmt too, so Post-Read is not going to work for this script.

    I appreciate the feedback though.

  • 0 in reply to jepritch

    Would calling the ReadAdditional() method prior to using the GetValue, in the way Kevin is trying to, force the object to read all the child sources and populate the variables he is after?

    I always wondered about that.

  • 0 in reply to David Speck

    That would be good to know if there was a way to force refresh such data... but in recent script testing I also found out that even the listed child sources are not always reliable.

    When I tried grabbing information about the two GL accounts through SalesAcctKey and CostOfGoodsSoldAcctKey, they were pointing at the same GL account (even though the keys were different).  (That was in v2013 though, so maybe things are different in more recent versions).