1 Reply Latest reply: Feb 22, 2013 3:48 PM by Bunty RSS

    Inconsistant actions with the update script

      Ok so I'm working on a script to send a email after X number of days (I asked this before and hit problems with it even after I had help), and I've been trying to chip away at it and I notice something that made no sense (Unless I'm missing something). I have two if statements to check if it's time to send a email (One for the amount of days that pass, and another to lock it out after the first time it sends a email). Problem is even that UCM doesn't seem to care about the fact that dateCurrent() is not greater then lastEntryTs even though doing the test it works fine, yet sitting in the workflow it doesn't seem to care.

      The code is pretty much this
      <$if formatDateWithPattern(wfGet("lastEntryTs"), "yyMMdd") < formatDateWithPattern(dateCurrent(), "yyMMdd")$>
      <$if xinteger_flag == 0$>
      <$wfMessage="OK this should work now"$>
      <$wfNotify("test_user", "user")$>
      <$wfUpdateMetaData("xinteger_flag", 1)$>

      <$if formatDateWithPattern(wfGet("lastEntryTs"), "yyMMdd") < formatDateWithPattern(dateCurrent(-1), "yyMMdd")$>
      <$if xinteger_flag == 1$>
      <$wfMessage="OK this should work not for the second time"$>
      <$wfNotify("test_user", "user")$>
      <$wfUpdateMetaData("xinteger_flag", 2)$>

      Now if I test this under the test tab it works fine as is (and if I change dateCurrent(+1) it works as it should being a day over what I wanted), and it changes xinteger_flag and that works. But when I put a item in this work flow it doesn't work as it should and I still get a email every hour just like before. Any idea what I'm doing wrong with this script?
        • 1. Re: Inconsistant actions with the update script
          when the item enters workflow and after your custom mail notificaiton do you see the xinteger_flag set to 1?

          change <$wfUpdateMetaData("xinteger_flag", 1)$>
          <$wfUpdateMetaData("xinteger_flag", "1")$>

          you could also try appending the flag to mail
          <$wfMessage="OK this should work now : " & xinteger_flag$>
          Edited by: Bunty on Feb 22, 2013 3:46 PM