Scripting

  • 1.  hello there hopefully someone can shed some light

    Posted 06-13-2017 06:27
    hello there hopefully someone can shed some light on this problem. I have a script a client is using in conjunction with Alerts and workflow to flag (checkbox) changes in required dates. However when they upgraded to 5.4.1 it stopped allowing me to set the value of the ""udf date field"" in update 1 it even deletes the required date and stops all functions. for 5.4.0 required date stays and the comparison works fine however we cant set the udf date field, though ultimately we would like it to work in update 1. Rdate = """" 'required date value udf_Acknowledge_Date = """" 'Acknowledge date value this is a date UDF 'this section stores the values into the variables retval = obusobj.getvalue(""RequiredDate$"", Rdate) retval = obusobj.setvalue(""Commenttext$"", Rdate) 'done to see the stored value of rdate retval = obusobj.getvalue(""UDF_ORIGINAL_ACKNOWLEDGED_DATE$"", udf_Acknowledge_Date) 'if the UDF is blank then store the required date into it if udf_Acknowledge_Date = """" then retval = obusobj.setvalue(""UDF_ORIGINAL_ACKNOWLEDGED_DATE$"",Rdate) end if 'if the UDF date doesn't equal the required date then tick the check box if udf_Acknowledge_Date <> rdate then retval = obusobj.setvalue(""UDF_ALERT_CHG$"", ""Y"") end if


  • 2.  RE: hello there hopefully someone can shed some light

    Posted 06-13-2017 07:19
    It sounds like a permission or ODBC security issue, but are all your retvals returning 1? If not, what does it report for oSession.LastErrorNum & oSession.LastErrorMsg?


  • 3.  RE: hello there hopefully someone can shed some light

    Posted 06-13-2017 07:38
    Update: error message is "" ""1/20/2020"" is not numeric. (CI_NotNumeric)"" Steve, as sad as this may sound I'm unsure what you mean by returning 1, the rdate in the beginning is returning the date for the comment text of the line. for ODBC I have this disabled in my test environment. for the osession.lasterrornum & oSession.lastErrorMSG I tried using MsgBox oSession.LastErrorMsg & "" ("" & oSession.LastErrorNum & "")"" at the last line though I suspect that's incorrect, as it didn't have an effect other than no longer deleting the required date. Sorry I've learned the scripting via adapting others scrips, trial and error, what little documentation I find, and utilizing prior C++ knowledge.


  • 4.  RE: hello there hopefully someone can shed some light

    Posted 06-13-2017 08:25
      |   view attached
    No worries. Take a look at the attached. What event is triggering this script? PreValidate on the SO Header?

    Attachment(s)

    txt
    UDF.txt   880 B 1 version


  • 5.  RE: hello there hopefully someone can shed some light

    Posted 06-19-2017 07:45
    I just saw your update, but did you get past this? It sounds like you'll need to convert the date from 1/20/2020 back to 20200120 prior to SetValue.


  • 6.  RE: hello there hopefully someone can shed some light

    Posted 06-19-2017 07:53
      |   view attached
    yes actually it was a comedy of problems, when replicating the error on my system it truncated ""UDF_ORIGINAL_ACKNOWLEDGED_DATE$"" to ""UDF_ORIGINAL_ACKNOWLEDGED$"" but other than that i have no idea why the attached script works. If you have any thoughts I'm all ears because I'm not sure whats different (the client's udf is actually UDF_ORIGINAL_ACKNOWLEDGED_DATE$). Also thank you for showing me the debug script that will come in handy quite a bit.

    Attachment(s)

    txt
    udf.txt   880 B 1 version


  • 7.  RE: hello there hopefully someone can shed some light

    Posted 06-19-2017 08:10
    Ha, cool. Maybe it just wanted the re-compile.