Scripting

  • 1.  Someone please intercept my trip to the insane asy

    Posted 06-09-2016 15:19
    Someone please intercept my trip to the insane asylum... Simple script to take CI_Item StandardUnitCost and store it as the P/O UnitCost on the QuantityOrdered Column-Post Validate event: 1. retVal1 = oItem.GetValue(""StandardUnitCost"", nUnitCost) 2. retVal2 = oBusObj.SetValue(""UnitCost"", nUnitCost) Works fine. However, if I change the StandardUnitCost in I/M (and Accept the change) the updated cost isn't ""seen"" by subsequent GetValue's for an existing P/O detail line. If I add a new line (same item), the updated cost is ""seen"". DebugPrint statements confirm that the GetValue is retrieving old values for existing lines and new values for new lines. Too weird. TIA


  • 2.  RE: Someone please intercept my trip to the insane asy

    Posted 06-09-2016 15:43
    If you change the Quantity Ordered, it will not get the new Standard Cost, but if you add a new line it will? Are you sure the script is firing on the existing line?


  • 3.  RE: Someone please intercept my trip to the insane asy

    Posted 06-09-2016 20:04
    Thanks for the inquiry. I figured out what is happening. Its just how MAS90 works and I am now in the insane asylum. The CI_Item object is only retrieved once for each time the row is selected. I held the same row selected while repeatedly changing the StandardUnitCost in CI_Item and changing the QuantityOrdered on that row. The CI_Item entry (including the StandardUnitCost) is only retrieved once even though I changed the quantity repeatedly. I assumed that since QuantityOrdered affects cost that it would retrieve the cost each time quantity changed. It doesn't.


  • 4.  RE: Someone please intercept my trip to the insane asy

    Posted 06-10-2016 05:22
    If you drop and re-create the oItem object, does it still pick up the old value?


  • 5.  RE: Someone please intercept my trip to the insane asy

    Posted 06-10-2016 05:40
    Are you using the GetChildHandle or calling CI_Item directly?


  • 6.  RE: Someone please intercept my trip to the insane asy

    Posted 06-10-2016 10:04
    @SteveIwanowski DropOjbect would be for BOI or button scripts. It fails in a UDS @MichaelNottoli I was using GetChildHandle, but Y O U A R E T H E M A N ! ! !. Calling CI_Item directly does fetch the new cost without leaving the current line!