13 Replies Latest reply on Oct 15, 2019 10:33 AM by Sinisa Mikor

    Time addtion in date and time field

    Amit Sambyal
      Share This:

      Hi All,

       

      I m trying to create a workflow which should calculate the time after a certain period (i.e 30 minutes) wrt to date and time value available in the field(i.e up Time, Actual Incident Time)

       

      Please suggest how can I achieve this.

        • 1. Re: Time addtion in date and time field
          Amit Sambyal

          Hi Eli,

           

          Requirement is i have the date/time value in Date/Time field(Up Time) now i want to create a workflow which should fired when the time difference between the value in the Date/Time field and current time is greater than 31 minutes.

           

          Also the challenge is how to calculate this exact time value ($UP TIme$ - $SERVERTIMESTAMP$)  which should be exactly 31 minutes.

          Eli James

          • 2. Re: Time addtion in date and time field
            Sidhdesh Punaskar

            $TIMESTAMP$ - $UP time$ > (60* 31)

            1 of 1 people found this helpful
            • 3. Re: Time addtion in date and time field
              Amit Sambyal

              Hi Sidhdesh,

               

              Thanks for your reply

              Is it recommended to use this as my run if qualification or i need to first store this value in the integer field and then use the same in the Run if Qualification?

              • 4. Re: Time addtion in date and time field
                Sidhdesh Punaskar

                You can directly use in run if

                • 5. Re: Time addtion in date and time field
                  Sinisa Mikor

                  Do you need workflow to trigger precisely at the end of that time interval, or any time after it passes?  In both cases you'd also need to add time-based workflow action (escalation) and way to control its execution for, I presume, multiple outstanding timers (each minute in first case, once in a while in the other).

                  • 6. Re: Time addtion in date and time field
                    Phillip Brockhaus

                    If you want to store the +31 minute date/time, you can do that too.

                     

                    I think you said that your two fields were "Up Time" and "Actual Incident Time"?

                    So, if we were to make Date/Time field "Up Time" equal to "Actual Incident Time" + 31 minutes, that would be similar to what was posted by Sidhdesh Punaskar above.

                    Set fields - Up Time = Actual Incident Time + (60*31)

                    And then your escalation could just be $TIMESTAMP$ > Up Time

                    Of course, your escalation will need to be set to run every minute, which could eventually impact server performance if your tables are large or if you have inefficient workflow.

                     

                    If your tables are going to get very large, it may be a better practice to create a new table called "Incident Escalation Control" or something like that - And then have incidents create a new record in this table when they are going to need attention within 30 minutes. This new form would hold that +31 minute timestamp and when triggered by the 1 minute escalation, it would push back to some new trigger field on the incident form triggering the code needed there, and then the escalation control record could either delete itself, or push itself to some archive form and then delete itself. That way, your one minute escalation would only ever be running against a relatively small table.

                    1 of 1 people found this helpful
                    • 7. Re: Time addtion in date and time field
                      Amit Sambyal

                      Hi Sinisa,

                       

                      What i m trying here i need to set some values in the fields when my run if qualification met its criteria.

                       

                      My run if qualification criteria is difference of ServerTimeStamp(Server Time or System Time) - UP Time(Date/Time Field) > 31 minutes along with other static fields values

                      • 8. Re: Time addtion in date and time field
                        Amit Sambyal

                        Hi Phillip,

                         

                        What I m trying here I need to set some values in the fields when my run if qualification met its criteria and i m using filter to perform this action

                         

                        My run if qualification criteria are the difference of ServerTimeStamp(Server Time or System Time) - UP Time(Date/Time Field) > 31 minutes along with other static fields values

                        • 9. Re: Time addtion in date and time field
                          Phillip Brockhaus

                          You can't "trigger" this workflow with a filter. A filter only executes when some action happens to the record in question. (Like, create, modify, etc.)

                          Escalations are similar to filters, but they are time based instead of action based.

                           

                          You must use an escalation if you want to execute workflow based on a clock.

                           

                          Still, it might be wise to have the bulk of the work done in filters for a variety of reason.

                           

                          To accomplish this,

                          1. create a new DISPLAY-ONLY checkbox on your form. Perhaps call it "Execute 31 minute code"
                          2. create your filters to execute when that checkbox = checked
                          3. create a new escalation that runs every minute that compares your date/time + (60*31) to timestamp as above
                          4. the escalation should have just a single set-fields action, setting a value to your new display only checkbox field

                          Except, this could be a dangerous strategy, as I outlined before. Written like this, it will execute on almost every record in your table, so the run-if will need to be modified (step 3 above) so that it excludes tickets that no longer need this. Since I don't know what your application looks like, I can't tell you exactly what that should be.

                           

                          That's why I outlined the idea of creating a new table. This is a pretty involved concept. I can go into more detail after work.

                          If you plan on moving forward with this today, I suggest you paste the run-if criteria of your escalation in this thread so that it can be evaluated by the community. This is the sort of thing that could cause big problems if not done right.

                          2 of 2 people found this helpful
                          • 10. Re: Time addtion in date and time field
                            Amit Sambyal

                            Hi Phillip,

                             

                            I will elaborate on my requirement here, I have a few fields based on which workflow triggers.

                             

                            the run if qualification is

                             

                            Status=A and Status Reason=B and UP Time(date/Time)= has some value suppose it contain 15th Oct 2019 11:00:00 AM.

                             

                            when this qualification met

                            then required workflow need to trigger after for 30 minutes from the given UP time(i.e it should trigger at 15th Oct 2019 11:31:00 AM) and changed the

                            value in the Status Reason =C

                            • 11. Re: Time addtion in date and time field
                              Sinisa Mikor

                              Run If Qualification does not trigger an action, it merely directs flow once action is triggered by another action or external event -- as Phillip explains: filters get triggered when an action on record is requested, while escalations trigger at predefined time or at predefined time intervals.  Once triggered, both of these workflow elements can be directed to If Actions or Else Actions using Run If Qualification -- in your example, you could have an escalation triggering each minute and (once triggered) checking if Status = A AND Status Reason = B AND UP Time > $TIMESTAMP$ using Run If Qualification. Philip already explained two methods of using escalations, the naive approach and a more complex one which could diminish performance drop.

                               

                              There is a third approach available in one special case -- if action (change of Status Reason to C) doesn't have to happen immediately after time runs out, it is possible to avoid using (explicit) escalations altogether.  Instead, you could set up filter triggered when record is accessed and have it make the change if Run If Qualification is true (Status = A AND Status Reason = B AND UP Time >= $TIMESTAMP$); don't forget to clear UP Time as soon as Status Reason is changed to C to avoid triggering actions over and over.  The problem with this approach is that it depends on someone or something accessing that record (which might be fine if records were displayed in auto-refreshing console/table because sooner or later that record will be reread after allotted time has passed), and that it takes some time to check if anything needs to be done every time any record from that form is read.

                              1 of 1 people found this helpful
                              • 12. Re: Time addtion in date and time field
                                Phillip Brockhaus

                                When does the work need to happen? 31 minutes after the record is created, or 31 minutes after some other event?