Scripting

  • 1.  Hi there, I am working with Sales Order detail en

    Posted 12-07-2017 13:49
      |   view attached
    Hi there, I am working with Sales Order detail entry. In this scenario the customer has a UDF checkbox on the warehouse to indicate if the warehouse is a consignment warehouse or not. Then on the line level details we have a Consignment Price UDF field. When a line is entered, I want the system to check the current line warehouse and if the UDF checkbox is checked, move the unit price amount to the Consignment Price UDF field for that line and zero out the Unit price field. I have the script working that achieves the above results EXCEPT when there is a price code involved. When there is a price code discount involved, it appears to recalculate everything upon clicking on the totals tab and fills the unit prices back in. So my question is am I correct that there is an event related to the Price Code when clicking the totals tab? I thought about moving the script to the sales order header and rolling through the lines upon table pretotals, but then we dont get to see the lines update. I attached the script in a text file here. I tried firing the script on Sales Order Detail >> Column Post Validate - Unit Price. I also tried it on Sales Order Detal >> Table Prewrite. Both give the same results. Thank you for your help! Marc

    Attachment(s)

    txt
    ConsignmentScript.txt   3 KB 1 version


  • 2.  RE: Hi there, I am working with Sales Order detail en

    Posted 12-07-2017 14:21
    Going to the totals tab wouldn't reset your UnitPrice overrides with any PriceCode logic. Regarding your Column Post Validate script on UnitPrice, there is no event for when the unit price is computed for a PriceCode calculation. Also, I don't know what's happening when you moved the same script to Table Prewrite, but adding more DebugPrint statements after the SetValue that shows the resulting retVal would be helpful. I would put your script on the Sales Order Detail .ColumnPostValidate.QuantityOrdered field. That way, your script always runs and overwrites anything done by price calculations.