Scripting

  • 1.  Searching for simple script examples.It's been 4

    Posted 06-02-2018 08:43
    Searching for simple script examples. It's been 4 years since I've done any scripting and I can't find my old documentation. I want to do a ""simple"" script to show the GP% for a SO_SalesOrderDetail line based of a UDF cost field. I've forgotten the vb syntax and format, and need some examples to get my brain cells on track again (like that will ever happen...)


  • 2.  RE: Searching for simple script examples.It's been 4

    Posted 06-02-2018 09:10
    something like? ext = 0 cost = 0 retVal = oBusObj.GetValue(""ExtensionAmt"", ext) retVal = oBusObj.GetValue(""UDF_EXTCOST"", cost) if ext <> 0 then retVal = oBusObj.SetValue(""UDF_GP"", (ext-cost)/ext*100) end if


  • 3.  RE: Searching for simple script examples.It's been 4

    Posted 06-02-2018 09:35
    Yup, that's looking familiar. I can feel this brain cells kicking in! Thanks


  • 4.  RE: Searching for simple script examples.It's been 4

    Posted 06-04-2018 09:22
      |   view attached
    I think I'm getting close, but forgetting something obvious. Attached is a screenshot of the script. My issue now is what event to trigger this on. I mistakenly said to trigger on pre-validation of the UDF_PURCOST field, which doesn't really get validated (see attached). So which field should I trigger on at what event?

    Attachment(s)

    docx
    GP_Pct_Script_question.docx   287 KB 1 version


  • 5.  RE: Searching for simple script examples.It's been 4

    Posted 06-04-2018 09:41
    I would trigger it based on the event 'Column - Post-Validate' and based on the 'QuantityOrdered' field