Scripting

  • 1.  Please don't make fun of me for what I believe is

    Posted 01-07-2016 16:02
    Please don't make fun of me for what I believe is going to be a simple answer, but I need help understanding and resolving something. I have created a very simple script for the SO_SalesOrderDetail table to find the Standard Cost for an item, calculate the Net Profit % using the Unit Price, and then setting it into a UDF, since the client uses Standard Cost and doesn't care for the Average Cost showing in the Tool Tip area. The calculation works great UNTIL I change the Unit Price. Then the UDF doesn't recalculate. Is there something easy to make this happen upon changes to the Unit Price as well as initial entry? Thanks in advance!


  • 2.  RE: Please don't make fun of me for what I believe is

    Posted 01-07-2016 16:15
    Run rhe script for the calculation of gross profit on post-validate of the unit price column and that should do it for you


  • 3.  RE: Please don't make fun of me for what I believe is

    Posted 01-07-2016 16:23
    Thanks, Robert. I tried that too, but it will only work if I keep it as Post Validate on Item Code, I assume because I'm feeding in the mapped CI_StandardUnitCost field. The UDF stays blank when I set it to post validate on Unit Price. I think I will try mapping a new SO Detail UDF to bring in the Item Standard Cost instead of using the script. Then I can try post validate on Unit Price again.


  • 4.  RE: Please don't make fun of me for what I believe is

    Posted 01-07-2016 16:32
    For this type of thing, I usually run the script on various fields in case they change. So, I might run it on post-validate of the following columns -- quantity ordered (since that will automatically change price based on pricing rules) and unit price (in case it's changed manually).


  • 5.  RE: Please don't make fun of me for what I believe is

    Posted 01-07-2016 16:34
      |   view attached
    I've never validated on more than one field before. Is this what you mean (see attached image)?


  • 6.  RE: Please don't make fun of me for what I believe is

    Posted 01-07-2016 16:39
    Exactly!


  • 7.  RE: Please don't make fun of me for what I believe is

    Posted 01-07-2016 16:46
    Holy crap - thanks for teaching me something new! I got this to work with my UDF for standard cost...now I'm going to go back and try it with the oItem object. Thanks!!